Project

General

Profile

Download (124 KB) Statistics
| Branch: | Tag: | Revision:
1 8a9edda5 Scott Ullrich
<?php
2 b46bfcf5 Bill Marquette
/* $Id$ */
3 5b237745 Scott Ullrich
/*
4 b2bc44cd Scott Ullrich
	interfaces.php
5 78fcfb9c Scott Ullrich
	Copyright (C) 2004-2008 Scott Ullrich
6 744ea190 Scott Ullrich
	Copyright (C) 2006 Daniel S. Haischt.
7 32764288 Namezero
	Copyright (C) 2008-2010 Ermal Lu?i
8 c3b3cd36 Scott Ullrich
	All rights reserved.
9 b1c525ee Scott Ullrich
10 c3b3cd36 Scott Ullrich
	originally part of m0n0wall (http://m0n0.ch/wall)
11 5b237745 Scott Ullrich
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
12
	All rights reserved.
13 e2cd32df Scott Ullrich
14 5b237745 Scott Ullrich
	Redistribution and use in source and binary forms, with or without
15
	modification, are permitted provided that the following conditions are met:
16 e2cd32df Scott Ullrich
17 5b237745 Scott Ullrich
	1. Redistributions of source code must retain the above copyright notice,
18
	   this list of conditions and the following disclaimer.
19 e2cd32df Scott Ullrich
20 5b237745 Scott Ullrich
	2. Redistributions in binary form must reproduce the above copyright
21
	   notice, this list of conditions and the following disclaimer in the
22
	   documentation and/or other materials provided with the distribution.
23 e2cd32df Scott Ullrich
24 5b237745 Scott Ullrich
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
25
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
26
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
28
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33
	POSSIBILITY OF SUCH DAMAGE.
34
*/
35 7ac5a4cb Scott Ullrich
/*
36
	pfSense_BUILDER_BINARIES:	/usr/sbin/arp
37
	pfSense_MODULE:	interfaces
38
*/
39 5b237745 Scott Ullrich
40 6b07c15a Matthew Grooms
##|+PRIV
41 01eb687d Ermal Luçi
##|*IDENT=page-interfaces
42 6b07c15a Matthew Grooms
##|*NAME=Interfaces: WAN page
43 998552f8 Ermal Luçi
##|*DESCR=Allow access to the 'Interfaces' page.
44 01eb687d Ermal Luçi
##|*MATCH=interfaces.php*
45 6b07c15a Matthew Grooms
##|-PRIV
46
47 f81cfcc9 jim-p
require_once("guiconfig.inc");
48
require_once("ipsec.inc");
49
require_once("functions.inc");
50
require_once("captiveportal.inc");
51
require_once("filter.inc");
52
require_once("shaper.inc");
53
require_once("rrd.inc");
54
require_once("vpn.inc");
55 1fb064e8 Erik Fonnesbeck
require_once("xmlparse_attr.inc");
56 199d8121 Ermal Luçi
57 94556105 Scott Ullrich
// Get configured interface list
58 dd18038e Ermal
$ifdescrs = get_configured_interface_with_descr(false, true);
59 94556105 Scott Ullrich
60 dd18038e Ermal
$if = "wan";
61
if ($_REQUEST['if'])
62 bd58d230 Scott Ullrich
	$if = $_REQUEST['if'];
63 dd18038e Ermal
64
if (empty($ifdescrs[$if])) {
65
	Header("Location: interfaces.php");
66
	exit;
67 9ff9a1c7 Seth Mos
}
68 6b07c15a Matthew Grooms
69 58af5941 Scott Ullrich
define("CRON_MONTHLY_PATTERN", "0 0 1 * *");
70
define("CRON_WEEKLY_PATTERN", "0 0 * * 0");
71
define("CRON_DAILY_PATTERN", "0 0 * * *");
72
define("CRON_HOURLY_PATTERN", "0 * * * *");
73 dc711694 Scott Ullrich
74 d85ba87f gnhb
if (!is_array($config['ppps']['ppp']))
75
	$config['ppps']['ppp'] = array();
76
77
$a_ppps = &$config['ppps']['ppp'];
78 58af5941 Scott Ullrich
79 f1f60c92 Ermal Luçi
function remove_bad_chars($string) {
80 e7346f05 Erik Fonnesbeck
	return preg_replace('/[^a-z_0-9]/i','',$string);
81 f1f60c92 Ermal Luçi
}
82
83 d173230c Seth Mos
if (!is_array($config['gateways']['gateway_item']))
84
	$config['gateways']['gateway_item'] = array();
85
$a_gateways = &$config['gateways']['gateway_item'];
86
87 f1f60c92 Ermal Luçi
$wancfg = &$config['interfaces'][$if];
88 ee5c01b5 Seth Mos
$old_wancfg = $wancfg;
89 dd18038e Ermal
// Populate page descr if it does not exist.
90
if ($if == "wan" && !$wancfg['descr'])
91
	$wancfg['descr'] = "WAN";
92
else if ($if == "lan" && !$wancfg['descr'])
93
	$wancfg['descr'] = "LAN";
94
95 5b237745 Scott Ullrich
96 8256f324 gnhb
foreach ($a_ppps as $pppid => $ppp) {
97 1d7e1d6c gnhb
	if ($wancfg['if'] == $ppp['if'])
98 8256f324 gnhb
		break;
99 30ade846 gnhb
}
100
101 1d7e1d6c gnhb
if ($wancfg['if'] == $a_ppps[$pppid]['if']) {
102 30ade846 gnhb
	$pconfig['pppid'] = $pppid;
103 1d7e1d6c gnhb
	$pconfig['ptpid'] = $a_ppps[$pppid]['ptpid'];
104
	$pconfig['port'] = $a_ppps[$pppid]['ports'];
105 70e46e62 Ermal
	if ($a_ppps[$pppid]['type'] == "ppp") {
106 3a906378 gnhb
		$pconfig['username'] = $a_ppps[$pppid]['username'];
107
		$pconfig['password'] = base64_decode($a_ppps[$pppid]['password']);
108 c0948c6c Renato Botelho
109 3a906378 gnhb
		$pconfig['phone'] = $a_ppps[$pppid]['phone'];
110
		$pconfig['apn'] = $a_ppps[$pppid]['apn'];
111
	}
112 70e46e62 Ermal
	else if ($a_ppps[$pppid]['type'] == "pppoe") {
113 d85ba87f gnhb
		$pconfig['pppoe_username'] = $a_ppps[$pppid]['username'];
114
		$pconfig['pppoe_password'] = base64_decode($a_ppps[$pppid]['password']);
115
		$pconfig['provider'] = $a_ppps[$pppid]['provider'];
116
		$pconfig['pppoe_dialondemand'] = isset($a_ppps[$pppid]['ondemand']);
117
		$pconfig['pppoe_idletimeout'] = $a_ppps[$pppid]['idletimeout'];
118 5b237745 Scott Ullrich
119 d85ba87f gnhb
		/* ================================================ */
120
		/* = force a connection reset at a specific time? = */
121
		/* ================================================ */
122 c0948c6c Renato Botelho
123 d85ba87f gnhb
		if (isset($a_ppps[$pppid]['pppoe-reset-type'])) {
124
			$pconfig['pppoe-reset-type'] = $a_ppps[$pppid]['pppoe-reset-type'];
125 1d7e1d6c gnhb
			$itemhash = getMPDCRONSettings($a_ppps[$pppid]['if']);
126 70e46e62 Ermal
			if ($itemhash)
127
				$cronitem = $itemhash['ITEM'];
128 e40e6724 gnhb
			if (isset($cronitem)) {
129
				$resetTime = "{$cronitem['minute']} {$cronitem['hour']} {$cronitem['mday']} {$cronitem['month']} {$cronitem['wday']}";
130
			} else {
131
				$resetTime = NULL;
132
			}
133 70e46e62 Ermal
			//log_error("ResetTime:".$resetTime);
134 d85ba87f gnhb
			if ($a_ppps[$pppid]['pppoe-reset-type'] == "custom") {
135 70e46e62 Ermal
				if ($cronitem) {
136
					$pconfig['pppoe_pr_custom'] = true;
137
					$pconfig['pppoe_resetminute'] = $cronitem['minute'];
138
					$pconfig['pppoe_resethour'] = $cronitem['hour'];
139
					if ($cronitem['mday'] <> "*" && $cronitem['month'] <> "*")
140
						$pconfig['pppoe_resetdate'] = "{$cronitem['month']}/{$cronitem['mday']}/" . date("Y");
141 af13aad6 Ermal
				}
142 d85ba87f gnhb
			} else if ($a_ppps[$pppid]['pppoe-reset-type'] == "preset") {
143
				$pconfig['pppoe_pr_preset'] = true;
144
				switch ($resetTime) {
145
					case CRON_MONTHLY_PATTERN:
146
						$pconfig['pppoe_monthly'] = true;
147
						break;
148
					case CRON_WEEKLY_PATTERN:
149
						$pconfig['pppoe_weekly'] = true;
150
						break;
151
					case CRON_DAILY_PATTERN:
152
						$pconfig['pppoe_daily'] = true;
153
						break;
154
					case CRON_HOURLY_PATTERN:
155
						$pconfig['pppoe_hourly'] = true;
156
						break;
157
				}
158
			}
159
		}// End force pppoe reset at specific time
160 c0948c6c Renato Botelho
	}// End if type == pppoe
161 e4d40f41 gnhb
	else if ($a_ppps[$pppid]['type'] == "pptp" || $a_ppps[$pppid]['type'] == "l2tp"){
162 d85ba87f gnhb
		$pconfig['pptp_username'] = $a_ppps[$pppid]['username'];
163
		$pconfig['pptp_password'] = base64_decode($a_ppps[$pppid]['password']);
164 4a1ee8ac gnhb
		$pconfig['pptp_local'] = explode(",",$a_ppps[$pppid]['localip']);
165
		$pconfig['pptp_subnet'] = explode(",",$a_ppps[$pppid]['subnet']);
166
		$pconfig['pptp_remote'] = explode(",",$a_ppps[$pppid]['gateway']);
167 d85ba87f gnhb
		$pconfig['pptp_dialondemand'] = isset($a_ppps[$pppid]['ondemand']);
168
		$pconfig['pptp_idletimeout'] = $a_ppps[$pppid]['timeout'];
169
	}
170 8256f324 gnhb
} else {
171 1d7e1d6c gnhb
	$pconfig['ptpid'] = interfaces_ptpid_next();
172 8256f324 gnhb
	$pppid = count($a_ppps);
173 d85ba87f gnhb
}
174 5b237745 Scott Ullrich
$pconfig['dhcphostname'] = $wancfg['dhcphostname'];
175 bc40d758 Seth Mos
$pconfig['alias-address'] = $wancfg['alias-address'];
176
$pconfig['alias-subnet'] = $wancfg['alias-subnet'];
177 e4d40f41 gnhb
$pconfig['dhcp_plus'] = isset($wancfg['dhcp_plus']);
178 f1f60c92 Ermal Luçi
$pconfig['descr'] = remove_bad_chars($wancfg['descr']);
179 6a688547 Ermal
$pconfig['enable'] = isset($wancfg['enable']);
180 f1f60c92 Ermal Luçi
181 9ff9a1c7 Seth Mos
if (is_array($config['aliases']['alias'])) {
182
	foreach($config['aliases']['alias'] as $alias) {
183
		if($alias['name'] == $wancfg['descr']) {
184 ea6be4a7 Erik Fonnesbeck
			$input_errors[] = sprintf(gettext("Sorry, an alias with the name %s already exists."),$wancfg['descr']);
185 9ff9a1c7 Seth Mos
		}
186
	}
187
}
188
189
switch($wancfg['ipaddr']) {
190
	case "dhcp":
191
		$pconfig['type'] = "dhcp";
192
		break;
193
	case "pppoe":
194
	case "pptp":
195 e4d40f41 gnhb
	case "l2tp":
196 611ae852 Ermal
	case "ppp":
197 d85ba87f gnhb
		$pconfig['type'] = $wancfg['ipaddr'];
198 611ae852 Ermal
		break;
199 9ff9a1c7 Seth Mos
	default:
200
		if(is_ipaddr($wancfg['ipaddr'])) {
201 47593ac6 Seth Mos
			$pconfig['type'] = "staticv4";
202 9ff9a1c7 Seth Mos
			$pconfig['ipaddr'] = $wancfg['ipaddr'];
203
			$pconfig['subnet'] = $wancfg['subnet'];
204
			$pconfig['gateway'] = $wancfg['gateway'];
205 dd18038e Ermal
		} else
206 9ff9a1c7 Seth Mos
			$pconfig['type'] = "none";
207
		break;
208
}
209 5b237745 Scott Ullrich
210 47593ac6 Seth Mos
switch($wancfg['ipaddrv6']) {
211 feb88a14 smos
	case "slaac":
212
		$pconfig['type6'] = "slaac";
213
		break;
214 e029943a Seth Mos
	case "dhcp6":
215
		$pconfig['dhcp6-duid'] = $wancfg['dhcp6-duid'];
216
		if($wancfg['dhcp6-ia-pd-len'] == "")
217
			$wancfg['dhcp6-ia-pd-len'] = "none";
218
		$pconfig['dhcp6-ia-pd-len'] = $wancfg['dhcp6-ia-pd-len'];
219
		$pconfig['type6'] = "dhcp6";
220
		break;
221 31c43fd3 smos
	case "6to4":
222
		$pconfig['type6'] = "6to4";
223
		break;
224 20a7cb15 smos
	case "track6":
225
		$pconfig['type6'] = "track6";
226
		$pconfig['track6-interface'] = $wancfg['track6-interface'];
227
		$pconfig['track6-prefix-id'] = $wancfg['track6-prefix-id'];
228 6b2d4b5a Darren Embry
		if ($wancfg['track6-prefix-id'] == "" || $wancfg['track6-prefix-id'] == "none") {
229
			$pconfig['track6-prefix-id--hex'] = "";
230
		} else {
231
			$pconfig['track6-prefix-id--hex'] = sprintf("%x", $wancfg['track6-prefix-id']);
232
		}
233 20a7cb15 smos
		break;
234 7d567088 smos
	case "6rd":
235
		$pconfig['prefix-6rd'] = $wancfg['prefix-6rd'];
236 12215bfb smos
		if($wancfg['prefix-6rd-v4plen'] == "")
237
			$wancfg['prefix-6rd-v4plen'] = "0";
238
		$pconfig['prefix-6rd-v4plen'] = $wancfg['prefix-6rd-v4plen'];
239 7d567088 smos
		$pconfig['type6'] = "6rd";
240
		$pconfig['gateway-6rd'] = $wancfg['gateway-6rd'];
241
		break;
242 47593ac6 Seth Mos
	default:
243 e029943a Seth Mos
		if(is_ipaddr($wancfg['ipaddrv6'])) {
244
			$pconfig['type6'] = "staticv6";
245 47593ac6 Seth Mos
			$pconfig['ipaddrv6'] = $wancfg['ipaddrv6'];
246
			$pconfig['subnetv6'] = $wancfg['subnetv6'];
247
			$pconfig['gatewayv6'] = $wancfg['gatewayv6'];
248 e029943a Seth Mos
		} else
249
			$pconfig['type6'] = "none";
250 47593ac6 Seth Mos
		break;
251
}
252
253 0eb78676 smos
// print_r($pconfig);
254 47593ac6 Seth Mos
255 5b237745 Scott Ullrich
$pconfig['blockpriv'] = isset($wancfg['blockpriv']);
256 ff1955ee Bill Marquette
$pconfig['blockbogons'] = isset($wancfg['blockbogons']);
257 5b237745 Scott Ullrich
$pconfig['spoofmac'] = $wancfg['spoofmac'];
258
$pconfig['mtu'] = $wancfg['mtu'];
259 4cea5cf8 Ermal
$pconfig['mss'] = $wancfg['mss'];
260 5b237745 Scott Ullrich
261
/* Wireless interface? */
262 b7f01f59 Bill Marquette
if (isset($wancfg['wireless'])) {
263 ebf94efb Erik Fonnesbeck
	/* Sync first to be sure it displays the actual settings that will be used */
264
	interface_sync_wireless_clones($wancfg, false);
265 4634cb48 Ermal Luçi
	/* Get wireless modes */
266 10394059 Scott Ullrich
	$wlanif = get_real_interface($if);
267 3f23b74d Erik Fonnesbeck
	if (!does_interface_exist($wlanif))
268
		interface_wireless_clone($wlanif, $wancfg);
269 34808d4e Erik Fonnesbeck
	$wlanbaseif = interface_get_wireless_base($wancfg['if']);
270 6681fdd3 Erik Fonnesbeck
	preg_match("/^(.*?)([0-9]*)$/", $wlanbaseif, $wlanbaseif_split);
271 10394059 Scott Ullrich
	$wl_modes = get_wireless_modes($if);
272 f4094f0d Erik Fonnesbeck
	$wl_chaninfo = get_wireless_channel_info($if);
273 6681fdd3 Erik Fonnesbeck
	$wl_sysctl_prefix = 'dev.' . $wlanbaseif_split[1] . '.' . $wlanbaseif_split[2];
274 537bf7b3 Erik Fonnesbeck
	$wl_sysctl = get_sysctl(array("{$wl_sysctl_prefix}.diversity", "{$wl_sysctl_prefix}.txantenna", "{$wl_sysctl_prefix}.rxantenna",
275
	                              "{$wl_sysctl_prefix}.slottime", "{$wl_sysctl_prefix}.acktimeout", "{$wl_sysctl_prefix}.ctstimeout"));
276 071d63b9 Erik Fonnesbeck
	$wl_regdomain_xml_attr = array();
277
	$wl_regdomain_xml = parse_xml_regdomain($wl_regdomain_xml_attr);
278
	$wl_regdomains = &$wl_regdomain_xml['regulatory-domains']['rd'];
279
	$wl_regdomains_attr = &$wl_regdomain_xml_attr['regulatory-domains']['rd'];
280
	$wl_countries = &$wl_regdomain_xml['country-codes']['country'];
281
	$wl_countries_attr = &$wl_regdomain_xml_attr['country-codes']['country'];
282 f62c44d8 Erik Fonnesbeck
	$pconfig['persistcommonwireless'] = isset($config['wireless']['interfaces'][$wlanbaseif]);
283 4634cb48 Ermal Luçi
	$pconfig['standard'] = $wancfg['wireless']['standard'];
284
	$pconfig['mode'] = $wancfg['wireless']['mode'];
285
	$pconfig['protmode'] = $wancfg['wireless']['protmode'];
286 ff2f4e43 Ermal Luçi
	$pconfig['ssid'] = $wancfg['wireless']['ssid'];
287 4634cb48 Ermal Luçi
	$pconfig['channel'] = $wancfg['wireless']['channel'];
288
	$pconfig['txpower'] = $wancfg['wireless']['txpower'];
289 537bf7b3 Erik Fonnesbeck
	$pconfig['diversity'] = $wancfg['wireless']['diversity'];
290
	$pconfig['txantenna'] = $wancfg['wireless']['txantenna'];
291
	$pconfig['rxantenna'] = $wancfg['wireless']['rxantenna'];
292 4634cb48 Ermal Luçi
	$pconfig['distance'] = $wancfg['wireless']['distance'];
293 20f09b3b Erik Fonnesbeck
	$pconfig['regdomain'] = $wancfg['wireless']['regdomain'];
294
	$pconfig['regcountry'] = $wancfg['wireless']['regcountry'];
295
	$pconfig['reglocation'] = $wancfg['wireless']['reglocation'];
296 4634cb48 Ermal Luçi
	$pconfig['wme_enable'] = isset($wancfg['wireless']['wme']['enable']);
297 57bbd532 Erik Fonnesbeck
	if (isset($wancfg['wireless']['puren']['enable']))
298
		$pconfig['puremode'] = '11n';
299
	else if (isset($wancfg['wireless']['pureg']['enable']))
300
		$pconfig['puremode'] = '11g';
301
	else
302
		$pconfig['puremode'] = 'any';
303 4634cb48 Ermal Luçi
	$pconfig['apbridge_enable'] = isset($wancfg['wireless']['apbridge']['enable']);
304
	$pconfig['authmode'] = $wancfg['wireless']['authmode'];
305
	$pconfig['hidessid_enable'] = isset($wancfg['wireless']['hidessid']['enable']);
306 5949124c Scott Ullrich
	$pconfig['auth_server_addr'] = $wancfg['wireless']['auth_server_addr'];
307
	$pconfig['auth_server_port'] = $wancfg['wireless']['auth_server_port'];
308
	$pconfig['auth_server_shared_secret'] = $wancfg['wireless']['auth_server_shared_secret'];
309 32764288 Namezero
	$pconfig['auth_server_addr2'] = $wancfg['wireless']['auth_server_addr2'];
310
	$pconfig['auth_server_port2'] = $wancfg['wireless']['auth_server_port2'];
311
	$pconfig['auth_server_shared_secret2'] = $wancfg['wireless']['auth_server_shared_secret2'];
312 4634cb48 Ermal Luçi
	if (is_array($wancfg['wireless']['wpa'])) {
313
		$pconfig['debug_mode'] = $wancfg['wireless']['wpa']['debug_mode'];
314
		$pconfig['macaddr_acl'] = $wancfg['wireless']['wpa']['macaddr_acl'];
315
		$pconfig['mac_acl_enable'] = isset($wancfg['wireless']['wpa']['mac_acl_enable']);
316
		$pconfig['auth_algs'] = $wancfg['wireless']['wpa']['auth_algs'];
317
		$pconfig['wpa_mode'] = $wancfg['wireless']['wpa']['wpa_mode'];
318
		$pconfig['wpa_key_mgmt'] = $wancfg['wireless']['wpa']['wpa_key_mgmt'];
319
		$pconfig['wpa_pairwise'] = $wancfg['wireless']['wpa']['wpa_pairwise'];
320
		$pconfig['wpa_group_rekey'] = $wancfg['wireless']['wpa']['wpa_group_rekey'];
321
		$pconfig['wpa_gmk_rekey'] = $wancfg['wireless']['wpa']['wpa_gmk_rekey'];
322
		$pconfig['wpa_strict_rekey'] = isset($wancfg['wireless']['wpa']['wpa_strict_rekey']);
323
		$pconfig['passphrase'] = $wancfg['wireless']['wpa']['passphrase'];
324 bfe1ef8c Ermal Luçi
		$pconfig['ieee8021x'] = isset($wancfg['wireless']['wpa']['ieee8021x']['enable']);
325 ea62cd32 Scott Ullrich
		$pconfig['rsn_preauth'] = isset($wancfg['wireless']['wpa']['rsn_preauth']);
326 4634cb48 Ermal Luçi
		$pconfig['ext_wpa_sw'] = $wancfg['wireless']['wpa']['ext_wpa_sw'];
327
		$pconfig['wpa_enable'] = isset($wancfg['wireless']['wpa']['enable']);
328
	}
329
	$pconfig['wep_enable'] = isset($wancfg['wireless']['wep']['enable']);
330
	$pconfig['mac_acl'] = $wancfg['wireless']['mac_acl'];
331 270c4607 Scott Ullrich
	if (is_array($wancfg['wireless']['wep']) && is_array($wancfg['wireless']['wep']['key'])) {
332 53c82ef9 Scott Ullrich
		$i = 1;
333
		foreach ($wancfg['wireless']['wep']['key'] as $wepkey) {
334
			$pconfig['key' . $i] = $wepkey['value'];
335
			if (isset($wepkey['txkey']))
336
				$pconfig['txkey'] = $i;
337
			$i++;
338
		}
339
		if (!isset($wepkey['txkey']))
340
			$pconfig['txkey'] = 1;
341 4634cb48 Ermal Luçi
	}
342 5b237745 Scott Ullrich
}
343
344 6b2d4b5a Darren Embry
$ipv6_delegation_length = calculate_ipv6_delegation_length($pconfig['track6-interface']);
345
$ipv6_num_prefix_ids = pow(2, $ipv6_delegation_length);
346
347 43e255d2 Ermal Luçi
if ($_POST['apply']) {
348 7994c3f8 Ermal Luçi
	unset($input_errors);
349 a368a026 Ermal Lu?i
	if (!is_subsystem_dirty('interfaces'))
350 136c598d Carlos Eduardo Ramos
		$intput_errors[] = gettext("You have already applied your settings!");
351 c0948c6c Renato Botelho
	else {
352 270c4607 Scott Ullrich
		unlink_if_exists("{$g['tmp_path']}/config.cache");
353 a368a026 Ermal Lu?i
		clear_subsystem_dirty('interfaces');
354 c0948c6c Renato Botelho
355 dd18038e Ermal
		if (file_exists("{$g['tmp_path']}/.interfaces.apply")) {
356
			$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.interfaces.apply"));
357 18f338da Ermal Lu?i
			foreach ($toapplylist as $ifapply => $ifcfgo) {
358
				interface_bring_down($ifapply, false, $ifcfgo);
359
				interface_configure($ifapply);
360 dd18038e Ermal
			}
361
		}
362 c0948c6c Renato Botelho
		/* restart snmp so that it binds to correct address */
363
		services_snmpd_configure();
364 a5d6f60b Ermal Lu?i
365 270c4607 Scott Ullrich
		/* sync filter configuration */
366 61fc1160 Scott Ullrich
		setup_gateways_monitor();
367 a5d6f60b Ermal Lu?i
368 18f338da Ermal Lu?i
		clear_subsystem_dirty('interfaces');
369 c0948c6c Renato Botelho
370 b4d36392 Scott Ullrich
		filter_configure();
371 c0948c6c Renato Botelho
372 1ee5d4b3 sullrich
		enable_rrd_graphing();
373 7994c3f8 Ermal Luçi
	}
374 dd18038e Ermal
	@unlink("{$g['tmp_path']}/.interfaces.apply");
375 7994c3f8 Ermal Luçi
	header("Location: interfaces.php?if={$if}");
376
	exit;
377 dd18038e Ermal
} else if ($_POST && $_POST['enable'] != "yes") {
378 270c4607 Scott Ullrich
	unset($wancfg['enable']);
379 dd18038e Ermal
	if (isset($wancfg['wireless']))
380 8f0289e7 Erik Fonnesbeck
		interface_sync_wireless_clones($wancfg, false);
381 270c4607 Scott Ullrich
	write_config("Interface {$_POST['descr']}({$if}) is now disabled.");
382 a368a026 Ermal Lu?i
	mark_subsystem_dirty('interfaces');
383 ee5c01b5 Seth Mos
	if (file_exists("{$g['tmp_path']}/.interfaces.apply")) {
384 dd18038e Ermal
		$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.interfaces.apply"));
385 ee5c01b5 Seth Mos
	} else {
386 dd18038e Ermal
		$toapplylist = array();
387 ee5c01b5 Seth Mos
	}
388 18f338da Ermal Lu?i
	$toapplylist[$if] = $wancfg;
389 ee5c01b5 Seth Mos
	/* we need to be able remove IP aliases for IPv6 */
390 dd18038e Ermal
	file_put_contents("{$g['tmp_path']}/.interfaces.apply", serialize($toapplylist));
391 270c4607 Scott Ullrich
	header("Location: interfaces.php?if={$if}");
392
	exit;
393 dd18038e Ermal
} else if ($_POST) {
394 270c4607 Scott Ullrich
395 53c82ef9 Scott Ullrich
	unset($input_errors);
396
	$pconfig = $_POST;
397 6b2d4b5a Darren Embry
	if ($pconfig['track6-prefix-id--hex'] === "") {
398
		$pconfig['track6-prefix-id'] = "none";
399
	} else if (is_numeric("0x" . $_POST['track6-prefix-id--hex'])) {
400
		$pconfig['track6-prefix-id'] = intval($_POST['track6-prefix-id--hex'], 16);
401
	} else {
402
		$pconfig['track6-prefix-id'] = "none";
403
	}
404 53c82ef9 Scott Ullrich
	conf_mount_rw();
405 fe24301f Ermal
406 53c82ef9 Scott Ullrich
	/* filter out spaces from descriptions  */
407
	$_POST['descr'] = remove_bad_chars($_POST['descr']);
408 fe24301f Ermal
409 b4d36392 Scott Ullrich
	/* okay first of all, cause we are just hiding the PPPoE HTML
410 53c82ef9 Scott Ullrich
	 * fields releated to PPPoE resets, we are going to unset $_POST
411
	 * vars, if the reset feature should not be used. Otherwise the
412
	 * data validation procedure below, may trigger a false error
413
	 * message.
414
	 */
415 e40e6724 gnhb
	if (empty($_POST['pppoe-reset-type'])) {
416 c0948c6c Renato Botelho
		unset($_POST['pppoe_pr_type']);
417 53c82ef9 Scott Ullrich
		unset($_POST['pppoe_resethour']);
418
		unset($_POST['pppoe_resetminute']);
419
		unset($_POST['pppoe_resetdate']);
420
		unset($_POST['pppoe_pr_preset_val']);
421
	}
422
	/* description unique? */
423 dd18038e Ermal
	foreach ($ifdescrs as $ifent => $ifdescr) {
424 79851fc8 Ermal
		if ($if != $ifent && $ifdescr == $_POST['descr']) {
425 136c598d Carlos Eduardo Ramos
			$input_errors[] = gettext("An interface with the specified description already exists.");
426 79851fc8 Ermal
			break;
427
		}
428 53c82ef9 Scott Ullrich
	}
429
	/* input validation */
430 e029943a Seth Mos
	if (isset($config['dhcpd']) && isset($config['dhcpd'][$if]['enable']) && (! preg_match("/^staticv4/", $_POST['type'])))
431 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("The DHCP Server is active on this interface and it can be used only with a static IP configuration. Please disable the DHCP Server service on this interface first, then change the interface configuration.");
432 e029943a Seth Mos
	if (isset($config['dhcpd6']) && isset($config['dhcpd6'][$if]['enable']) && (! preg_match("/^staticv6/", $_POST['type6'])))
433
		$input_errors[] = gettext("The DHCP6 Server is active on this interface and it can be used only with a static IPv6 configuration. Please disable the DHCPv6 Server service on this interface first, then change the interface configuration.");
434 0c9da721 Ermal Lu?i
435 ef130e9f Ermal
	switch(strtolower($_POST['type'])) {
436 47593ac6 Seth Mos
		case "staticv4":
437 9ff9a1c7 Seth Mos
			$reqdfields = explode(" ", "ipaddr subnet gateway");
438 47593ac6 Seth Mos
			$reqdfieldsn = array(gettext("IPv4 address"),gettext("Subnet bit count"),gettext("Gateway"));
439
			do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
440
			break;
441 88c00a65 Ermal
		case "none":
442 62a4abc9 Ermal
			if(is_array($config['virtualip']['vip'])) {
443
				foreach ($config['virtualip']['vip'] as $vip) {
444 2452cc37 Darren Embry
					if (is_ipaddrv4($vip['subnet']) && $vip['interface'] == $if)
445
						$input_errors[] = gettext("This interface is referenced by IPv4 VIPs. Please delete those before setting the interface to 'none' configuration.");
446 62a4abc9 Ermal
				}
447
			}
448 88c00a65 Ermal
		case "dhcp":
449 a9543eae Seth Mos
			if (in_array($wancfg['ipaddr'], array("ppp", "pppoe", "pptp", "l2tp")))
450 d1d0a1ad Vinicius Coque
				$input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."),$_POST['type']);
451 47593ac6 Seth Mos
			break;
452 513b762e gnhb
		case "ppp":
453
			$reqdfields = explode(" ", "port phone");
454 8cc6876f groo
			$reqdfieldsn = array(gettext("Modem Port"),gettext("Phone Number"));
455 513b762e gnhb
			do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
456
			break;
457 ef130e9f Ermal
		case "pppoe":
458 9ff9a1c7 Seth Mos
			if ($_POST['pppoe_dialondemand']) {
459
				$reqdfields = explode(" ", "pppoe_username pppoe_password pppoe_dialondemand pppoe_idletimeout");
460 8cc6876f groo
				$reqdfieldsn = array(gettext("PPPoE username"),gettext("PPPoE password"),gettext("Dial on demand"),gettext("Idle timeout value"));
461 9ff9a1c7 Seth Mos
			} else {
462
				$reqdfields = explode(" ", "pppoe_username pppoe_password");
463 8cc6876f groo
				$reqdfieldsn = array(gettext("PPPoE username"),gettext("PPPoE password"));
464 9ff9a1c7 Seth Mos
			}
465
			do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
466
			break;
467 ef130e9f Ermal
		case "pptp":
468 9ff9a1c7 Seth Mos
			if ($_POST['pptp_dialondemand']) {
469
				$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote pptp_dialondemand pptp_idletimeout");
470 8cc6876f groo
				$reqdfieldsn = array(gettext("PPTP username"),gettext("PPTP password"),gettext("PPTP local IP address"),gettext("PPTP subnet"),gettext("PPTP remote IP address"),gettext("Dial on demand"),gettext("Idle timeout value"));
471 9ff9a1c7 Seth Mos
			} else {
472
				$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote");
473 8cc6876f groo
				$reqdfieldsn = array(gettext("PPTP username"),gettext("PPTP password"),gettext("PPTP local IP address"),gettext("PPTP subnet"),gettext("PPTP remote IP address"));
474 9ff9a1c7 Seth Mos
			}
475
			do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
476
			break;
477 e4d40f41 gnhb
		case "l2tp":
478
			if ($_POST['pptp_dialondemand']) {
479
				$reqdfields = explode(" ", "pptp_username pptp_password pptp_remote pptp_dialondemand pptp_idletimeout");
480
				$reqdfieldsn = array(gettext("L2TP username"),gettext("L2TP password"),gettext("L2TP remote IP address"),gettext("Dial on demand"),gettext("Idle timeout value"));
481
			} else {
482
				$reqdfields = explode(" ", "pptp_username pptp_password pptp_remote");
483
				$reqdfieldsn = array(gettext("L2TP username"),gettext("L2TP password"),gettext("L2TP remote IP address"));
484
			}
485
			do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
486
			break;
487 53c82ef9 Scott Ullrich
	}
488 e029943a Seth Mos
	switch(strtolower($_POST['type6'])) {
489
		case "staticv6":
490 20b49b17 Seth Mos
			$reqdfields = explode(" ", "ipaddrv6 subnetv6 gatewayv6");
491 1e37f324 smos
			$reqdfieldsn = array(gettext("IPv6 address"),gettext("Subnet bit count"),gettext("Gateway"));
492 e029943a Seth Mos
			do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
493
			break;
494
		case "none":
495
			if(is_array($config['virtualip']['vip'])) {
496
				foreach ($config['virtualip']['vip'] as $vip) {
497 2452cc37 Darren Embry
					if (is_ipaddrv6($vip['subnet']) && $vip['interface'] == $if)
498
						$input_errors[] = gettext("This interface is referenced by IPv6 VIPs. Please delete those before setting the interface to 'none' configuration.");
499 e029943a Seth Mos
				}
500
			}
501
		case "dhcp6":
502
			if (in_array($wancfg['ipaddrv6'], array()))
503 8b198c64 smos
				$input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."),$_POST['type6']);
504 e029943a Seth Mos
			break;
505 7d567088 smos
		case "6rd":
506 8b198c64 smos
			foreach ($ifdescrs as $ifent => $ifdescr) {
507 c616b3c7 smos
				if ($if != $ifent && (($config[interfaces][$ifent]['ipaddrv6'] == $_POST['type6']) || ($config[interfaces][$ifent]['ipaddrv6'] == "6to4")) ) {
508 8b198c64 smos
					$input_errors[] = sprintf(gettext("You can only have one interface configured as %s or 6to4."),$_POST['type6']);
509
					break;
510
				}
511
			}
512 7d567088 smos
			if (in_array($wancfg['ipaddrv6'], array()))
513 8b198c64 smos
				$input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."),$_POST['type6']);
514 7d567088 smos
			break;
515 31c43fd3 smos
		case "6to4":
516 8b198c64 smos
			foreach ($ifdescrs as $ifent => $ifdescr) {
517 c616b3c7 smos
				if ($if != $ifent && (($config[interfaces][$ifent]['ipaddrv6'] == $_POST['type6']) || ($config[interfaces][$ifent]['ipaddrv6'] == "6rd")) ) {
518 8b198c64 smos
					$input_errors[] = sprintf(gettext("You can only have one interface configured as %s or 6rd."),$_POST['type6']);
519
					break;
520
				}
521
			}
522 31c43fd3 smos
			if (in_array($wancfg['ipaddrv6'], array()))
523 8b198c64 smos
				$input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."),$_POST['type6']);
524 31c43fd3 smos
			break;
525 20a7cb15 smos
		case "track6":
526
			/* needs to check if $track6-prefix-id is used on another interface */
527
			if (in_array($wancfg['ipaddrv6'], array()))
528 8b198c64 smos
				$input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."),$_POST['type6']);
529 6b2d4b5a Darren Embry
530
			if ($_POST['track6-prefix-id--hex'] != "" && !is_numeric("0x" . $_POST['track6-prefix-id--hex'])) {
531
				$input_errors[] = gettext("You must enter a valid hexadecimal number for the IPv6 prefix ID.");
532
			} else {
533
				$track6_prefix_id = intval($_POST['track6-prefix-id--hex'], 16);
534
				if ($track6_prefix_id < 0 || $track6_prefix_id >= $ipv6_num_prefix_ids) {
535
					$input_errors[] = gettext("You specified an IPv6 prefix ID that is out of range.");
536
				}
537
			}
538 20a7cb15 smos
			break;
539 e029943a Seth Mos
	}
540 9ff9a1c7 Seth Mos
541 e029943a Seth Mos
	
542 53c82ef9 Scott Ullrich
	/* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */
543
	$_POST['spoofmac'] = strtolower(str_replace("-", ":", $_POST['spoofmac']));
544 c0948c6c Renato Botelho
	if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr'])))
545 47593ac6 Seth Mos
		$input_errors[] = gettext("A valid IPv4 address must be specified.");
546
	if (($_POST['ipaddrv6'] && !is_ipaddr($_POST['ipaddrv6'])))
547
		$input_errors[] = gettext("A valid IPv6 address must be specified.");
548 c0948c6c Renato Botelho
	if (($_POST['subnet'] && !is_numeric($_POST['subnet'])))
549 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("A valid subnet bit count must be specified.");
550 47593ac6 Seth Mos
	if (($_POST['subnetv6'] && !is_numeric($_POST['subnetv6'])))
551
		$input_errors[] = gettext("A valid subnet bit count must be specified.");
552 c0948c6c Renato Botelho
	if (($_POST['alias-address'] && !is_ipaddr($_POST['alias-address'])))
553 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("A valid alias IP address must be specified.");
554 c0948c6c Renato Botelho
	if (($_POST['alias-subnet'] && !is_numeric($_POST['alias-subnet'])))
555 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("A valid alias subnet bit count must be specified.");
556 47593ac6 Seth Mos
	if (($_POST['gateway'] != "none") || ($_POST['gatewayv6'] != "none")) {
557 53c82ef9 Scott Ullrich
		$match = false;
558 9ff9a1c7 Seth Mos
		foreach($a_gateways as $gateway) {
559
			if(in_array($_POST['gateway'], $gateway)) {
560 53c82ef9 Scott Ullrich
				$match = true;
561 9ff9a1c7 Seth Mos
			}
562
		}
563 47593ac6 Seth Mos
		foreach($a_gateways as $gateway) {
564
			if(in_array($_POST['gatewayv6'], $gateway)) {
565
				$match = true;
566
			}
567
		}
568 9ff9a1c7 Seth Mos
		if(!$match) {
569 136c598d Carlos Eduardo Ramos
			$input_errors[] = gettext("A valid gateway must be specified.");
570 9ff9a1c7 Seth Mos
		}
571 53c82ef9 Scott Ullrich
	}
572 c0948c6c Renato Botelho
	if (($_POST['provider'] && !is_domain($_POST['provider'])))
573 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("The service name contains invalid characters.");
574 c0948c6c Renato Botelho
	if (($_POST['pppoe_idletimeout'] != "") && !is_numericint($_POST['pppoe_idletimeout']))
575 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("The idle timeout value must be an integer.");
576 c0948c6c Renato Botelho
	if ($_POST['pppoe_resethour'] <> "" && !is_numericint($_POST['pppoe_resethour']) &&
577
		$_POST['pppoe_resethour'] >= 0 && $_POST['pppoe_resethour'] <=23)
578 53c82ef9 Scott Ullrich
			$input_errors[] = gettext("A valid PPPoE reset hour must be specified (0-23).");
579 c0948c6c Renato Botelho
	if ($_POST['pppoe_resetminute'] <> "" && !is_numericint($_POST['pppoe_resetminute']) &&
580
		$_POST['pppoe_resetminute'] >= 0 && $_POST['pppoe_resetminute'] <=59)
581 53c82ef9 Scott Ullrich
			$input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59).");
582 c0948c6c Renato Botelho
	if ($_POST['pppoe_resetdate'] <> "" && !is_numeric(str_replace("/", "", $_POST['pppoe_resetdate'])))
583 53c82ef9 Scott Ullrich
		$input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy).");
584 c0948c6c Renato Botelho
	if (($_POST['pptp_local'] && !is_ipaddr($_POST['pptp_local'])))
585 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("A valid PPTP local IP address must be specified.");
586 c0948c6c Renato Botelho
	if (($_POST['pptp_subnet'] && !is_numeric($_POST['pptp_subnet'])))
587 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("A valid PPTP subnet bit count must be specified.");
588 e4d40f41 gnhb
	if (($_POST['pptp_remote'] && !is_ipaddr($_POST['pptp_remote']) && !is_hostname($_POST['gateway'][$iface])))
589 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("A valid PPTP remote IP address must be specified.");
590 c0948c6c Renato Botelho
	if (($_POST['pptp_idletimeout'] != "") && !is_numericint($_POST['pptp_idletimeout']))
591 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("The idle timeout value must be an integer.");
592 c0948c6c Renato Botelho
	if (($_POST['spoofmac'] && !is_macaddr($_POST['spoofmac'])))
593 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("A valid MAC address must be specified.");
594 c0948c6c Renato Botelho
	if ($_POST['mtu'] && ($_POST['mtu'] < 576))
595 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("The MTU must be greater than 576 bytes.");
596 c0948c6c Renato Botelho
	if ($_POST['mss'] && ($_POST['mss'] < 576))
597 4cea5cf8 Ermal
		$input_errors[] = gettext("The MSS must be greater than 576 bytes.");
598 53c82ef9 Scott Ullrich
	/* Wireless interface? */
599
	if (isset($wancfg['wireless'])) {
600 bb9d70d2 Erik Fonnesbeck
		$reqdfields = array("mode");
601
		$reqdfieldsn = array(gettext("Mode"));
602
		if ($_POST['mode'] == 'hostap') {
603
			$reqdfields[] = "ssid";
604
			$reqdfieldsn[] = gettext("SSID");
605
		}
606 53c82ef9 Scott Ullrich
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
607 597330aa Erik Fonnesbeck
		check_wireless_mode();
608 53c82ef9 Scott Ullrich
		/* loop through keys and enforce size */
609
		for ($i = 1; $i <= 4; $i++) {
610
			if ($_POST['key' . $i]) {
611
				/* 64 bit */
612
				if (strlen($_POST['key' . $i]) == 5)
613
					continue;
614
				if (strlen($_POST['key' . $i]) == 10) {
615
					/* hex key */
616
					if (stristr($_POST['key' . $i], "0x") == false) {
617 4634cb48 Ermal Luçi
						$_POST['key' . $i] = "0x" . $_POST['key' . $i];
618
					}
619 53c82ef9 Scott Ullrich
					continue;
620
				}
621
				if (strlen($_POST['key' . $i]) == 12) {
622
					/* hex key */
623
					if(stristr($_POST['key' . $i], "0x") == false) {
624
					$_POST['key' . $i] = "0x" . $_POST['key' . $i];
625 4634cb48 Ermal Luçi
					}
626 53c82ef9 Scott Ullrich
					continue;
627
				}
628
				/* 128 bit */
629
				if (strlen($_POST['key' . $i]) == 13)
630
					continue;
631
				if (strlen($_POST['key' . $i]) == 26) {
632
					/* hex key */
633
					if (stristr($_POST['key' . $i], "0x") == false)
634
						$_POST['key' . $i] = "0x" . $_POST['key' . $i];
635
					continue;
636 4634cb48 Ermal Luçi
				}
637 53c82ef9 Scott Ullrich
				if(strlen($_POST['key' . $i]) == 28)
638
					continue;
639 136c598d Carlos Eduardo Ramos
				$input_errors[] =  gettext("Invalid WEP key size.   Sizes should be 40 (64) bit keys or 104 (128) bit.");
640 53c82ef9 Scott Ullrich
				break;
641 4634cb48 Ermal Luçi
			}
642 5b237745 Scott Ullrich
		}
643 08fae438 Ermal Lu?i
644
		if ($_POST['passphrase']) {
645
                	$passlen = strlen($_POST['passphrase']);
646
                	if ($passlen < 8 || $passlen > 64)
647 136c598d Carlos Eduardo Ramos
                        	$input_errors[] = gettext("The length of the passphrase should be between 8 and 63 characters.");
648 08fae438 Ermal Lu?i
		}
649 53c82ef9 Scott Ullrich
	}
650
	if (!$input_errors) {
651 8b1e7d04 Ermal
		if ($wancfg['ipaddr'] != $_POST['type']) {
652 ef130e9f Ermal
			if (in_array($wancfg['ipaddr'], array("ppp", "pppoe", "pptp", "l2tp"))) {
653
				$wancfg['if'] = $a_ppps[$pppid]['ports'];
654
				unset($a_ppps[$pppid]);
655 e029943a Seth Mos
			} else if ($wancfg['ipaddrv6'] == "dhcp6") {
656 76ac460b jim-p
				$pid = find_dhcp6c_process($wancfg['if']);
657 e029943a Seth Mos
				if($pid)
658
					posix_kill($pid, SIGTERM);
659 8b1e7d04 Ermal
			} else if ($wancfg['ipaddr'] == "dhcp") {
660 76ac460b jim-p
				$pid = find_dhclient_process($wancfg['if']);
661 1f676b67 Ermal
				if($pid)
662
					posix_kill($pid, SIGTERM);
663 ef130e9f Ermal
			}
664 1f676b67 Ermal
				
665 ef130e9f Ermal
		}
666 d85ba87f gnhb
		$ppp = array();
667 da75413d Ermal
		if ($wancfg['ipaddr'] != "ppp")
668
			unset($wancfg['ipaddr']);
669 47593ac6 Seth Mos
		if ($wancfg['ipaddrv6'] != "ppp")
670
			unset($wancfg['ipaddrv6']);
671 53c82ef9 Scott Ullrich
		unset($wancfg['subnet']);
672
		unset($wancfg['gateway']);
673 47593ac6 Seth Mos
		unset($wancfg['subnetv6']);
674
		unset($wancfg['gatewayv6']);
675 53c82ef9 Scott Ullrich
		unset($wancfg['dhcphostname']);
676 ed395640 Seth Mos
		unset($wancfg['dhcp6-duid']);
677
		unset($wancfg['dhcp6-ia-pd-len']);
678 20a7cb15 smos
		unset($wancfg['track6-interface']);
679
		unset($wancfg['track6-prefix-id']);		
680 7d567088 smos
		unset($wancfg['prefix-6rd']);
681 12215bfb smos
		unset($wancfg['prefix-6rd-v4plen']);
682 7d567088 smos
		unset($wancfg['gateway-6rd']);
683 53c82ef9 Scott Ullrich
		unset($wancfg['pppoe_password']);
684
		unset($wancfg['pptp_username']);
685
		unset($wancfg['pptp_password']);
686
		unset($wancfg['provider']);
687
		unset($wancfg['ondemand']);
688
		unset($wancfg['timeout']);
689 70e46e62 Ermal
		if (empty($wancfg['pppoe']['pppoe-reset-type']))
690 8b7ae9a3 jim-p
			unset($wancfg['pppoe']['pppoe-reset-type']);
691 53c82ef9 Scott Ullrich
		unset($wancfg['local']);
692 cb3c3fe4 Namezero
		
693 53c82ef9 Scott Ullrich
		unset($wancfg['remote']);
694 8256f324 gnhb
		unset($a_ppps[$pppid]['apn']);
695
		unset($a_ppps[$pppid]['phone']);
696
		unset($a_ppps[$pppid]['localip']);
697
		unset($a_ppps[$pppid]['subnet']);
698
		unset($a_ppps[$pppid]['gateway']);
699
		unset($a_ppps[$pppid]['pppoe-reset-type']);
700 1d7e1d6c gnhb
		unset($a_ppps[$pppid]['provider']);
701 c0948c6c Renato Botelho
702 53c82ef9 Scott Ullrich
		$wancfg['descr'] = remove_bad_chars($_POST['descr']);
703 6a688547 Ermal
		$wancfg['enable'] =  $_POST['enable']  == "yes" ? true : false;
704 9ff9a1c7 Seth Mos
705 2fe06a32 smos
		/* let return_gateways_array() do the magic on dynamic interfaces for us */
706 9ff9a1c7 Seth Mos
		switch($_POST['type']) {
707 47593ac6 Seth Mos
			case "staticv4":
708
				$wancfg['ipaddr'] = $_POST['ipaddr'];
709
				$wancfg['subnet'] = $_POST['subnet'];
710
				if ($_POST['gateway'] != "none") {
711
					$wancfg['gateway'] = $_POST['gateway'];
712
				}
713
				break;
714 9ff9a1c7 Seth Mos
			case "dhcp":
715
				$wancfg['ipaddr'] = "dhcp";
716
				$wancfg['dhcphostname'] = $_POST['dhcphostname'];
717
				$wancfg['alias-address'] = $_POST['alias-address'];
718
				$wancfg['alias-subnet'] = $_POST['alias-subnet'];
719 e4d40f41 gnhb
				$wancfg['dhcp_plus'] = $_POST['dhcp_plus'] == "yes" ? true : false;
720 9ff9a1c7 Seth Mos
				if($gateway_item) {
721
					$a_gateways[] = $gateway_item;
722
				}
723
				break;
724 3a906378 gnhb
			case "ppp":
725
				$a_ppps[$pppid]['ptpid'] = $_POST['ptpid'];
726
				$a_ppps[$pppid]['type'] = $_POST['type'];
727 1d7e1d6c gnhb
				$a_ppps[$pppid]['if'] = $_POST['type'].$_POST['ptpid'];
728 3a906378 gnhb
				$a_ppps[$pppid]['ports'] = $_POST['port'];
729
				$a_ppps[$pppid]['username'] = $_POST['username'];
730
				$a_ppps[$pppid]['password'] = base64_encode($_POST['password']);
731 8256f324 gnhb
				$a_ppps[$pppid]['phone'] = $_POST['phone'];
732 3a906378 gnhb
				$a_ppps[$pppid]['apn'] = $_POST['apn'];
733 1d7e1d6c gnhb
				$wancfg['if'] = $_POST['type'] . $_POST['ptpid'];
734 8256f324 gnhb
				$wancfg['ipaddr'] = $_POST['type'];
735
				unset($a_ppps[$pppid]['ondemand']);
736
				unset($a_ppps[$pppid]['idletimeout']);
737 3a906378 gnhb
				break;
738
739 9ff9a1c7 Seth Mos
			case "pppoe":
740 6c05cfb0 gnhb
				$a_ppps[$pppid]['ptpid'] = $_POST['ptpid'];
741
				$a_ppps[$pppid]['type'] = $_POST['type'];
742 1d7e1d6c gnhb
				$a_ppps[$pppid]['if'] = $_POST['type'].$_POST['ptpid'];
743 d85ba87f gnhb
				if (isset($_POST['ppp_port']))
744 6c05cfb0 gnhb
					$a_ppps[$pppid]['ports'] = $_POST['ppp_port'];
745 d85ba87f gnhb
				else
746 6c05cfb0 gnhb
					$a_ppps[$pppid]['ports'] = $wancfg['if'];
747
				$a_ppps[$pppid]['username'] = $_POST['pppoe_username'];
748
				$a_ppps[$pppid]['password'] = base64_encode($_POST['pppoe_password']);
749 d85ba87f gnhb
				if (!empty($_POST['provider']))
750 6c05cfb0 gnhb
					$a_ppps[$pppid]['provider'] = $_POST['provider'];
751 d85ba87f gnhb
				else
752 233e2af1 jim-p
					$a_ppps[$pppid]['provider'] = true;
753 6c05cfb0 gnhb
				$a_ppps[$pppid]['ondemand'] = $_POST['pppoe_dialondemand'] ? true : false;
754 0ff214f2 Renato Botelho
				if (!empty($_POST['pppoe_idletimeout']))
755 6c05cfb0 gnhb
					$a_ppps[$pppid]['idletimeout'] = $_POST['pppoe_idletimeout'];
756 d85ba87f gnhb
				else
757 6c05cfb0 gnhb
					unset($a_ppps[$pppid]['idletimeout']);
758 d85ba87f gnhb
759
				if (!empty($_POST['pppoe-reset-type']))
760 6c05cfb0 gnhb
					$a_ppps[$pppid]['pppoe-reset-type'] = $_POST['pppoe-reset-type'];
761 d85ba87f gnhb
				else
762 6c05cfb0 gnhb
					unset($a_ppps[$pppid]['pppoe-reset-type']);
763 1d7e1d6c gnhb
				$wancfg['if'] = $_POST['type'].$_POST['ptpid'];
764 d85ba87f gnhb
				$wancfg['ipaddr'] = $_POST['type'];
765 9ff9a1c7 Seth Mos
				if($gateway_item) {
766
					$a_gateways[] = $gateway_item;
767
				}
768 c0948c6c Renato Botelho
769 9ff9a1c7 Seth Mos
				break;
770
			case "pptp":
771 e4d40f41 gnhb
			case "l2tp":
772 6c05cfb0 gnhb
				$a_ppps[$pppid]['ptpid'] = $_POST['ptpid'];
773
				$a_ppps[$pppid]['type'] = $_POST['type'];
774 1d7e1d6c gnhb
				$a_ppps[$pppid]['if'] = $_POST['type'].$_POST['ptpid'];
775 d85ba87f gnhb
				if (isset($_POST['ppp_port']))
776 6c05cfb0 gnhb
					$a_ppps[$pppid]['ports'] = $_POST['ppp_port'];
777 d85ba87f gnhb
				else
778 6c05cfb0 gnhb
					$a_ppps[$pppid]['ports'] = $wancfg['if'];
779
				$a_ppps[$pppid]['username'] = $_POST['pptp_username'];
780
				$a_ppps[$pppid]['password'] = base64_encode($_POST['pptp_password']);
781 ced4df74 gnhb
				$a_ppps[$pppid]['localip'] = $_POST['pptp_local'];
782 6c05cfb0 gnhb
				$a_ppps[$pppid]['subnet'] = $_POST['pptp_subnet'];
783
				$a_ppps[$pppid]['gateway'] = $_POST['pptp_remote'];
784
				$a_ppps[$pppid]['ondemand'] = $_POST['pptp_dialondemand'] ? true : false;
785 0ff214f2 Renato Botelho
				if (!empty($_POST['pptp_idletimeout']))
786 6c05cfb0 gnhb
					$a_ppps[$pppid]['idletimeout'] = $_POST['pptp_idletimeout'];
787 d85ba87f gnhb
				else
788 6c05cfb0 gnhb
					unset($a_ppps[$pppid]['idletimeout']);
789 1d7e1d6c gnhb
				$wancfg['if'] = $_POST['type'].$_POST['ptpid'];
790 d85ba87f gnhb
				$wancfg['ipaddr'] = $_POST['type'];
791 9ff9a1c7 Seth Mos
				if($gateway_item) {
792
					$a_gateways[] = $gateway_item;
793
				}
794
				break;
795 6c05cfb0 gnhb
			case "none":
796
				break;
797 4634cb48 Ermal Luçi
		}
798 e029943a Seth Mos
		switch($_POST['type6']) {
799
			case "staticv6":
800
				$wancfg['ipaddrv6'] = $_POST['ipaddrv6'];
801
				$wancfg['subnetv6'] = $_POST['subnetv6'];
802
				if ($_POST['gatewayv6'] != "none") {
803
					$wancfg['gatewayv6'] = $_POST['gatewayv6'];
804
				}
805
				break;
806 feb88a14 smos
			case "slaac":
807
				$wancfg['ipaddrv6'] = "slaac";
808
				break;
809 e029943a Seth Mos
			case "dhcp6":
810
				$wancfg['ipaddrv6'] = "dhcp6";
811
				$wancfg['dhcp6-duid'] = $_POST['dhcp6-duid'];
812
				$wancfg['dhcp6-ia-pd-len'] = $_POST['dhcp6-ia-pd-len'];
813
				if($gateway_item) {
814
					$a_gateways[] = $gateway_item;
815
				}
816
				break;
817 7d567088 smos
			case "6rd":
818
				$wancfg['ipaddrv6'] = "6rd";
819
				$wancfg['prefix-6rd'] = $_POST['prefix-6rd'];
820 12215bfb smos
				$wancfg['prefix-6rd-v4plen'] = $_POST['prefix-6rd-v4plen'];
821 7d567088 smos
				$wancfg['gateway-6rd'] = $_POST['gateway-6rd'];
822
				if($gateway_item) {
823
					$a_gateways[] = $gateway_item;
824
				}
825
				break;
826 31c43fd3 smos
			case "6to4":
827
				$wancfg['ipaddrv6'] = "6to4";
828
				break;
829 20a7cb15 smos
			case "track6":
830
				$wancfg['ipaddrv6'] = "track6";
831
				$wancfg['track6-interface'] = $_POST['track6-interface'];
832 6b2d4b5a Darren Embry
				if ($_POST['track6-prefix-id--hex'] === "") {
833
					$wancfg['track6-prefix-id'] = "none";
834
				} else if (is_numeric("0x" . $_POST['track6-prefix-id--hex'])) {
835
					$wancfg['track6-prefix-id'] = intval($_POST['track6-prefix-id--hex'], 16);
836
				} else {
837
					$wancfg['track6-prefix-id'] = "none";
838
				}
839 20a7cb15 smos
				break;
840 e029943a Seth Mos
			case "none":
841
				break;
842
		}
843 1d7e1d6c gnhb
		handle_pppoe_reset($_POST);
844 c0948c6c Renato Botelho
845 9ff9a1c7 Seth Mos
		if($_POST['blockpriv'] == "yes") {
846 53c82ef9 Scott Ullrich
			$wancfg['blockpriv'] = true;
847 9ff9a1c7 Seth Mos
		} else {
848 53c82ef9 Scott Ullrich
			unset($wancfg['blockpriv']);
849 9ff9a1c7 Seth Mos
		}
850
		if($_POST['blockbogons'] == "yes") {
851 53c82ef9 Scott Ullrich
			$wancfg['blockbogons'] = true;
852 9ff9a1c7 Seth Mos
		} else {
853 53c82ef9 Scott Ullrich
			unset($wancfg['blockbogons']);
854 9ff9a1c7 Seth Mos
		}
855 53c82ef9 Scott Ullrich
		$wancfg['spoofmac'] = $_POST['spoofmac'];
856 9ff9a1c7 Seth Mos
		if (empty($_POST['mtu'])) {
857 d6a891da Ermal Lu?i
			unset($wancfg['mtu']);
858 9ff9a1c7 Seth Mos
		} else {
859 d6a891da Ermal Lu?i
			$wancfg['mtu'] = $_POST['mtu'];
860 9ff9a1c7 Seth Mos
		}
861 4cea5cf8 Ermal
		if (empty($_POST['mss'])) {
862
			unset($wancfg['mss']);
863
		} else {
864
			$wancfg['mss'] = $_POST['mss'];
865
		}
866 509ca889 Evgeny Yurchenko
		if (empty($_POST['mediaopt'])) {
867
			unset($wancfg['media']);
868
			unset($wancfg['mediaopt']);
869
		} else {
870
			$mediaopts = explode(' ', $_POST['mediaopt']);	
871
			if ($mediaopts[0] != ''){ $wancfg['media'] = $mediaopts[0]; }
872
			if ($mediaopts[1] != ''){ $wancfg['mediaopt'] = $mediaopts[1]; }
873
			else { unset($wancfg['mediaopt']); }
874
		}
875 9ff9a1c7 Seth Mos
		if (isset($wancfg['wireless'])) {
876 25a6411a Scott Ullrich
			handle_wireless_post();
877 9ff9a1c7 Seth Mos
		}
878 c0948c6c Renato Botelho
879 dd18038e Ermal
		conf_mount_ro();
880 53c82ef9 Scott Ullrich
		write_config();
881 dd18038e Ermal
882 ee5c01b5 Seth Mos
		if (file_exists("{$g['tmp_path']}/.interfaces.apply")) {
883 dd18038e Ermal
			$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.interfaces.apply"));
884 ee5c01b5 Seth Mos
		} else {
885 dd18038e Ermal
			$toapplylist = array();
886 ee5c01b5 Seth Mos
		}
887 18f338da Ermal Lu?i
		$toapplylist[$if] = $old_wancfg;
888 dd18038e Ermal
		file_put_contents("{$g['tmp_path']}/.interfaces.apply", serialize($toapplylist));
889
890 a368a026 Ermal Lu?i
		mark_subsystem_dirty('interfaces');
891 dd18038e Ermal
892 53c82ef9 Scott Ullrich
		/* regenerate cron settings/crontab file */
893
		configure_cron();
894 dd18038e Ermal
895 53c82ef9 Scott Ullrich
		header("Location: interfaces.php?if={$if}");
896
		exit;
897
	}
898 c0948c6c Renato Botelho
899
} // end if($_POST)
900 270c4607 Scott Ullrich
901 25a6411a Scott Ullrich
function handle_wireless_post() {
902 f62c44d8 Erik Fonnesbeck
	global $_POST, $config, $g, $wancfg, $if, $wl_countries_attr, $wlanbaseif;
903 270c4607 Scott Ullrich
	if (!is_array($wancfg['wireless']))
904
		$wancfg['wireless'] = array();
905
	$wancfg['wireless']['standard'] = $_POST['standard'];
906
	$wancfg['wireless']['mode'] = $_POST['mode'];
907
	$wancfg['wireless']['protmode'] = $_POST['protmode'];
908
	$wancfg['wireless']['ssid'] = $_POST['ssid'];
909
	$wancfg['wireless']['channel'] = $_POST['channel'];
910
	$wancfg['wireless']['authmode'] = $_POST['authmode'];
911
	$wancfg['wireless']['txpower'] = $_POST['txpower'];
912
	$wancfg['wireless']['distance'] = $_POST['distance'];
913 20f09b3b Erik Fonnesbeck
	$wancfg['wireless']['regdomain'] = $_POST['regdomain'];
914
	$wancfg['wireless']['regcountry'] = $_POST['regcountry'];
915
	$wancfg['wireless']['reglocation'] = $_POST['reglocation'];
916
	if (!empty($wancfg['wireless']['regdomain']) && !empty($wancfg['wireless']['regcountry'])) {
917 071d63b9 Erik Fonnesbeck
		foreach($wl_countries_attr as $wl_country) {
918
			if ($wancfg['wireless']['regcountry'] == $wl_country['ID']) {
919
				$wancfg['wireless']['regdomain'] = $wl_country['rd'][0]['REF'];
920 20f09b3b Erik Fonnesbeck
				break;
921
			}
922
		}
923
	}
924 270c4607 Scott Ullrich
	if (!is_array($wancfg['wireless']['wpa']))
925
		$wancfg['wireless']['wpa'] = array();
926
	$wancfg['wireless']['wpa']['macaddr_acl'] = $_POST['macaddr_acl'];
927
	$wancfg['wireless']['wpa']['auth_algs'] = $_POST['auth_algs'];
928
	$wancfg['wireless']['wpa']['wpa_mode'] = $_POST['wpa_mode'];
929
	$wancfg['wireless']['wpa']['wpa_key_mgmt'] = $_POST['wpa_key_mgmt'];
930
	$wancfg['wireless']['wpa']['wpa_pairwise'] = $_POST['wpa_pairwise'];
931
	$wancfg['wireless']['wpa']['wpa_group_rekey'] = $_POST['wpa_group_rekey'];
932
	$wancfg['wireless']['wpa']['wpa_gmk_rekey'] = $_POST['wpa_gmk_rekey'];
933
	$wancfg['wireless']['wpa']['passphrase'] = $_POST['passphrase'];
934
	$wancfg['wireless']['wpa']['ext_wpa_sw'] = $_POST['ext_wpa_sw'];
935 5949124c Scott Ullrich
	$wancfg['wireless']['auth_server_addr'] = $_POST['auth_server_addr'];
936
	$wancfg['wireless']['auth_server_port'] = $_POST['auth_server_port'];
937
	$wancfg['wireless']['auth_server_shared_secret'] = $_POST['auth_server_shared_secret'];
938 32764288 Namezero
	$wancfg['wireless']['auth_server_addr2'] = $_POST['auth_server_addr2'];
939
	$wancfg['wireless']['auth_server_port2'] = $_POST['auth_server_port2'];
940
	$wancfg['wireless']['auth_server_shared_secret2'] = $_POST['auth_server_shared_secret2'];
941
	
942 f62c44d8 Erik Fonnesbeck
	if ($_POST['persistcommonwireless'] == "yes") {
943 6ef2297b Erik Fonnesbeck
		if (!is_array($config['wireless']))
944
			$config['wireless'] = array();
945
		if (!is_array($config['wireless']['interfaces']))
946
			$config['wireless']['interfaces'] = array();
947
		if (!is_array($config['wireless']['interfaces'][$wlanbaseif]))
948 f62c44d8 Erik Fonnesbeck
			$config['wireless']['interfaces'][$wlanbaseif] = array();
949
	} else if (isset($config['wireless']['interfaces'][$wlanbaseif]))
950
		unset($config['wireless']['interfaces'][$wlanbaseif]);
951 1930ccb6 Erik Fonnesbeck
	if (isset($_POST['diversity']) && is_numeric($_POST['diversity']))
952 537bf7b3 Erik Fonnesbeck
		$wancfg['wireless']['diversity'] = $_POST['diversity'];
953
	else if (isset($wancfg['wireless']['diversity']))
954
		unset($wancfg['wireless']['diversity']);
955 1930ccb6 Erik Fonnesbeck
	if (isset($_POST['txantenna']) && is_numeric($_POST['txantenna']))
956 537bf7b3 Erik Fonnesbeck
		$wancfg['wireless']['txantenna'] = $_POST['txantenna'];
957
	else if (isset($wancfg['wireless']['txantenna']))
958
		unset($wancfg['wireless']['txantenna']);
959 1930ccb6 Erik Fonnesbeck
	if (isset($_POST['rxantenna']) && is_numeric($_POST['rxantenna']))
960 537bf7b3 Erik Fonnesbeck
		$wancfg['wireless']['rxantenna'] = $_POST['rxantenna'];
961
	else if (isset($wancfg['wireless']['rxantenna']))
962
		unset($wancfg['wireless']['rxantenna']);
963 270c4607 Scott Ullrich
	if ($_POST['hidessid_enable'] == "yes")
964
		$wancfg['wireless']['hidessid']['enable'] = true;
965
	else if (isset($wancfg['wireless']['hidessid']['enable']))
966
		unset($wancfg['wireless']['hidessid']['enable']);
967
	if ($_POST['mac_acl_enable'] == "yes")
968
		$wancfg['wireless']['wpa']['mac_acl_enable'] = true;
969
	else if (isset($wancfg['wireless']['wpa']['mac_acl_enable']))
970
		unset($wancfg['wireless']['wpa']['mac_acl_enable']);
971 c9e7d30d Scott Ullrich
	if ($_POST['rsn_preauth'] == "yes")
972 ea62cd32 Scott Ullrich
		$wancfg['wireless']['wpa']['rsn_preauth'] = true;
973 c0948c6c Renato Botelho
	else
974 ea62cd32 Scott Ullrich
		unset($wancfg['wireless']['wpa']['rsn_preauth']);
975 270c4607 Scott Ullrich
	if ($_POST['ieee8021x'] == "yes")
976
		$wancfg['wireless']['wpa']['ieee8021x']['enable'] = true;
977
	else if (isset($wancfg['wireless']['wpa']['ieee8021x']['enable']))
978
		unset($wancfg['wireless']['wpa']['ieee8021x']['enable']);
979
	if ($_POST['wpa_strict_rekey'] == "yes")
980
		$wancfg['wireless']['wpa']['wpa_strict_rekey'] = true;
981
	else if (isset($wancfg['wireless']['wpa']['wpa_strict_rekey']))
982
		unset($wancfg['wireless']['wpa']['wpa_strict_rekey']);
983
	if ($_POST['debug_mode'] == "yes")
984
		$wancfg['wireless']['wpa']['debug_mode'] = true;
985
	else if (isset($wancfg['wireless']['wpa']['debug_mode']))
986
		sunset($wancfg['wireless']['wpa']['debug_mode']);
987
	if ($_POST['wpa_enable'] == "yes")
988
		$wancfg['wireless']['wpa']['enable'] = $_POST['wpa_enable'] = true;
989
	else if (isset($wancfg['wireless']['wpa']['enable']))
990
		unset($wancfg['wireless']['wpa']['enable']);
991
	if ($_POST['wep_enable'] == "yes") {
992
		if (!is_array($wancfg['wireless']['wep']))
993
			$wancfg['wireless']['wep'] = array();
994
		$wancfg['wireless']['wep']['enable'] = $_POST['wep_enable'] = true;
995
	} else if (isset($wancfg['wireless']['wep']))
996
		unset($wancfg['wireless']['wep']);
997
	if ($_POST['wme_enable'] == "yes") {
998
		if (!is_array($wancfg['wireless']['wme']))
999
			$wancfg['wireless']['wme'] = array();
1000
		$wancfg['wireless']['wme']['enable'] = $_POST['wme_enable'] = true;
1001
	} else if (isset($wancfg['wireless']['wme']['enable']))
1002
		unset($wancfg['wireless']['wme']['enable']);
1003 57bbd532 Erik Fonnesbeck
	if ($_POST['puremode'] == "11g") {
1004 270c4607 Scott Ullrich
		if (!is_array($wancfg['wireless']['pureg']))
1005
			$wancfg['wireless']['pureg'] = array();
1006 57bbd532 Erik Fonnesbeck
		$wancfg['wireless']['pureg']['enable'] = true;
1007
	} else if ($_POST['puremode'] == "11n") {
1008 ed459692 Erik Fonnesbeck
		if (!is_array($wancfg['wireless']['puren']))
1009
			$wancfg['wireless']['puren'] = array();
1010 57bbd532 Erik Fonnesbeck
		$wancfg['wireless']['puren']['enable'] = true;
1011
	} else {
1012
		if (isset($wancfg['wireless']['pureg']))
1013
			unset($wancfg['wireless']['pureg']);
1014
		if (isset($wancfg['wireless']['puren']))
1015
			unset($wancfg['wireless']['puren']);
1016
	}
1017 270c4607 Scott Ullrich
	if ($_POST['apbridge_enable'] == "yes") {
1018
		if (!is_array($wancfg['wireless']['apbridge']))
1019
			$wancfg['wireless']['apbridge'] = array();
1020
		$wancfg['wireless']['apbridge']['enable'] = $_POST['apbridge_enable'] = true;
1021
	} else if (isset($wancfg['wireless']['apbridge']['enable']))
1022
		unset($wancfg['wireless']['apbridge']['enable']);
1023 9be20928 Erik Fonnesbeck
	if ($_POST['standard'] == "11g Turbo" || $_POST['standard'] == "11a Turbo") {
1024 270c4607 Scott Ullrich
		if (!is_array($wancfg['wireless']['turbo']))
1025
			$wancfg['wireless']['turbo'] = array();
1026
		$wancfg['wireless']['turbo']['enable'] = true;
1027
	} else if (isset($wancfg['wireless']['turbo']['enable']))
1028
		unset($wancfg['wireless']['turbo']['enable']);
1029
	$wancfg['wireless']['wep']['key'] = array();
1030
	for ($i = 1; $i <= 4; $i++) {
1031
		if ($_POST['key' . $i]) {
1032
			$newkey = array();
1033
			$newkey['value'] = $_POST['key' . $i];
1034
			if ($_POST['txkey'] == $i)
1035
				$newkey['txkey'] = true;
1036
			$wancfg['wireless']['wep']['key'][] = $newkey;
1037
		}
1038 5b237745 Scott Ullrich
	}
1039 8f0289e7 Erik Fonnesbeck
	interface_sync_wireless_clones($wancfg, true);
1040 5b237745 Scott Ullrich
}
1041 7f43ca88 Scott Ullrich
1042 597330aa Erik Fonnesbeck
function check_wireless_mode() {
1043 651fff4f Erik Fonnesbeck
	global $_POST, $config, $g, $wlan_modes, $wancfg, $if, $wlanif, $wlanbaseif, $old_wireless_mode, $input_errors;
1044 597330aa Erik Fonnesbeck
1045
	if ($wancfg['wireless']['mode'] == $_POST['mode'])
1046
		return;
1047
1048
	if (does_interface_exist(interface_get_wireless_clone($wlanbaseif)))
1049
		$clone_count = 1;
1050
	else
1051
		$clone_count = 0;
1052 6ef2297b Erik Fonnesbeck
	if (isset($config['wireless']['clone']) && is_array($config['wireless']['clone'])) {
1053 597330aa Erik Fonnesbeck
		foreach ($config['wireless']['clone'] as $clone) {
1054
			if ($clone['if'] == $wlanbaseif)
1055
				$clone_count++;
1056
		}
1057
	}
1058
	if ($clone_count > 1) {
1059
		$old_wireless_mode = $wancfg['wireless']['mode'];
1060
		$wancfg['wireless']['mode'] = $_POST['mode'];
1061
		if (!interface_wireless_clone("{$wlanif}_", $wancfg)) {
1062 4c807d76 Erik Fonnesbeck
			$input_errors[] = sprintf(gettext("Unable to change mode to %s.  You may already have the maximum number of wireless clones supported in this mode."), $wlan_modes[$wancfg['wireless']['mode']]);
1063 597330aa Erik Fonnesbeck
		} else {
1064
			mwexec("/sbin/ifconfig {$wlanif}_ destroy");
1065
		}
1066
		$wancfg['wireless']['mode'] = $old_wireless_mode;
1067
	}
1068
}
1069
1070 509ca889 Evgeny Yurchenko
// Find all possible media options for the interface
1071
$mediaopts_list = array();
1072
$intrealname = $config['interfaces'][$if]['if'];
1073
exec("/sbin/ifconfig -m $intrealname | grep \"media \"", $mediaopts);
1074
foreach ($mediaopts as $mediaopt){
1075
	preg_match("/media (.*)/", $mediaopt, $matches);
1076
 	if (preg_match("/(.*) mediaopt (.*)/", $matches[1], $matches1)){
1077
		// there is media + mediaopt like "media 1000baseT mediaopt full-duplex"
1078
 		array_push($mediaopts_list, $matches1[1] . " " . $matches1[2]);
1079
	}else{
1080
		// there is only media like "media 1000baseT"
1081
		array_push($mediaopts_list, $matches[1]);
1082
	}
1083
}
1084
1085 a6d9251e Scott Ullrich
$pgtitle = array(gettext("Interfaces"), $pconfig['descr']);
1086 b32dd0a6 jim-p
$shortcut_section = "interfaces";
1087 af1e2031 jim-p
1088 58af5941 Scott Ullrich
$closehead = false;
1089 7f43ca88 Scott Ullrich
include("head.inc");
1090 3e662cb0 Ermal
$types4 = array("none" => gettext("None"), "staticv4" => gettext("Static IPv4"), "dhcp" => gettext("DHCP"), "ppp" => gettext("PPP"), "pppoe" => gettext("PPPoE"), "pptp" => gettext("PPTP"), "l2tp" => gettext("L2TP"));
1091 feb88a14 smos
$types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"), "dhcp6" => gettext("DHCP6"), "slaac" => gettext("SLAAC"), "6rd" => gettext("6rd Tunnel"), "6to4" => gettext("6to4 Tunnel"), "track6" => gettext("Track Interface"));
1092 7f43ca88 Scott Ullrich
1093 5b237745 Scott Ullrich
?>
1094 7f43ca88 Scott Ullrich
1095 f51d5d57 Darren Embry
<script type="text/javascript" src="/javascript/jquery.ipv4v6ify.js"></script>
1096 8098302a Scott Ullrich
<script type="text/javascript" src="/javascript/numericupdown/js/numericupdown.js"></script>
1097 58af5941 Scott Ullrich
<link href="/javascript/numericupdown/css/numericupdown.css" rel="stylesheet" type="text/css" />
1098 8098302a Scott Ullrich
<script type="text/javascript" src="/javascript/datepicker/js/datepicker.js"></script>
1099
<link href="/javascript/datepicker/css/datepicker.css" rel="stylesheet" type="text/css"/>
1100 58af5941 Scott Ullrich
1101
<script type="text/javascript">
1102 9978e156 gnhb
	function updateType(t) {
1103 886f1f69 Scott Ullrich
		switch(t) {
1104 9978e156 gnhb
			case "none": {
1105 076b14b2 Vinicius Coque
				jQuery('#staticv4, #dhcp, #pppoe, #pptp, #ppp').hide();
1106 47593ac6 Seth Mos
				break;
1107
			}
1108
			case "staticv4": {
1109 076b14b2 Vinicius Coque
				jQuery('#none, #dhcp, #pppoe, #pptp, #ppp').hide();
1110 9978e156 gnhb
				break;
1111
			}
1112
			case "dhcp": {
1113 076b14b2 Vinicius Coque
				jQuery('#none, #staticv4, #pppoe, #pptp, #ppp').hide();
1114 6c05cfb0 gnhb
				break;
1115
			}
1116
			case "ppp": {
1117 076b14b2 Vinicius Coque
				jQuery('#none, #staticv4, #dhcp, #pptp, #pppoe').hide();
1118 3a906378 gnhb
				country_list();
1119 9978e156 gnhb
				break;
1120
			}
1121
			case "pppoe": {
1122 076b14b2 Vinicius Coque
				jQuery('#none, #staticv4, #dhcp, #pptp, #ppp').hide();
1123 9978e156 gnhb
				break;
1124
			}
1125 e4d40f41 gnhb
			case "l2tp":
1126 9978e156 gnhb
			case "pptp": {
1127 076b14b2 Vinicius Coque
				jQuery('#none, #staticv4, #dhcp, #pppoe, #ppp').hide();
1128
				jQuery('#pptp').show();
1129 9978e156 gnhb
				break;
1130 09583657 Scott Ullrich
			}
1131 886f1f69 Scott Ullrich
		}
1132 e4d40f41 gnhb
		if (t != "l2tp" && t != "pptp")
1133 076b14b2 Vinicius Coque
			jQuery('#'+t).show();
1134 09583657 Scott Ullrich
	}
1135 e029943a Seth Mos
	function updateTypeSix(t) {
1136
		switch(t) {
1137
			case "none": {
1138 feb88a14 smos
				jQuery('#staticv6, #dhcp6, #6rd, #6to4, #track6, #slaac').hide();
1139 e029943a Seth Mos
				break;
1140
			}
1141
			case "staticv6": {
1142 feb88a14 smos
				jQuery('#none, #dhcp6, #6rd, #6to4, #track6, #slaac').hide();
1143
				break;
1144
			}
1145
			case "slaac": {
1146
				jQuery('#none, #staticv6, #6rd, #6to4, #track6, #dhcp6').hide();
1147 e029943a Seth Mos
				break;
1148
			}
1149
			case "dhcp6": {
1150 feb88a14 smos
				jQuery('#none, #staticv6, #6rd, #6to4, #track6, #slaac').hide();
1151 7d567088 smos
				break;
1152
			}
1153 adc91ab7 smos
			case "6rd": {
1154 feb88a14 smos
				jQuery('#none, #dhcp6, #staticv6, #6to4, #track6, #slaac').hide();
1155 31c43fd3 smos
				break;
1156
			}
1157
			case "6to4": {
1158 feb88a14 smos
				jQuery('#none, #dhcp6, #staticv6, #6rd, #track6, #slaac').hide();
1159 20a7cb15 smos
				break;
1160
			}
1161
			case "track6": {
1162 feb88a14 smos
				jQuery('#none, #dhcp6, #staticv6, #6rd, #6to4, #slaac').hide();
1163 e029943a Seth Mos
				break;
1164
			}
1165
		}
1166
		if (t != "l2tp" && t != "pptp")
1167 076b14b2 Vinicius Coque
			jQuery('#'+t).show();
1168 e029943a Seth Mos
	}
1169 32764288 Namezero
1170 886f1f69 Scott Ullrich
	function show_allcfg(obj) {
1171
		if (obj.checked)
1172 076b14b2 Vinicius Coque
			jQuery('#allcfg').show();
1173 886f1f69 Scott Ullrich
		else
1174 076b14b2 Vinicius Coque
			jQuery('#allcfg').hide();
1175 886f1f69 Scott Ullrich
	}
1176 9978e156 gnhb
1177 d85ba87f gnhb
	function show_reset_settings(reset_type) {
1178 c0948c6c Renato Botelho
		if (reset_type == 'preset') {
1179 076b14b2 Vinicius Coque
			jQuery('#pppoepresetwrap').show();
1180
			jQuery('#pppoecustomwrap').hide();
1181 c0948c6c Renato Botelho
		}
1182
		else if (reset_type == 'custom') {
1183 076b14b2 Vinicius Coque
			jQuery('#pppoecustomwrap').show();
1184
			jQuery('#pppoepresetwrap').hide();
1185 d85ba87f gnhb
		} else {
1186 076b14b2 Vinicius Coque
			jQuery('#pppoecustomwrap').hide();
1187
			jQuery('#pppoepresetwrap').hide();
1188 d85ba87f gnhb
		}
1189
	}
1190 886f1f69 Scott Ullrich
	function show_mon_config() {
1191 076b14b2 Vinicius Coque
		jQuery("#showmonbox").html('');
1192
		jQuery('#showmon').css('display','block');
1193 886f1f69 Scott Ullrich
	}
1194 4634cb48 Ermal Luçi
1195 886f1f69 Scott Ullrich
	function openwindow(url) {
1196
		var oWin = window.open(url,"pfSensePop","width=620,height=400,top=150,left=150");
1197 c0948c6c Renato Botelho
		if (oWin==null || typeof(oWin)=="undefined")
1198 886f1f69 Scott Ullrich
			return false;
1199 c0948c6c Renato Botelho
		else
1200 886f1f69 Scott Ullrich
			return true;
1201
	}
1202 3a906378 gnhb
	function country_list() {
1203 076b14b2 Vinicius Coque
		jQuery('#country').children().remove();
1204
		jQuery('#provider').children().remove();
1205
		jQuery('#providerplan').children().remove();
1206
		jQuery.ajax("getserviceproviders.php",{
1207
			success: function(response) {
1208
				var responseTextArr = response.split("\n");
1209 3a906378 gnhb
				responseTextArr.sort();
1210
				responseTextArr.each( function(value) {
1211
					var option = new Element('option');
1212
					country = value.split(":");
1213
					option.text = country[0];
1214
					option.value = country[1];
1215 076b14b2 Vinicius Coque
					jQuery('#country').append(option);
1216 3a906378 gnhb
				});
1217
			}
1218
		});
1219 076b14b2 Vinicius Coque
		jQuery('#trcountry').css('display',"table-row");
1220 3a906378 gnhb
	}
1221 c0948c6c Renato Botelho
1222 3a906378 gnhb
	function providers_list() {
1223 076b14b2 Vinicius Coque
		jQuery('#provider').children().remove();
1224
		jQuery('#providerplan').children().remove();
1225
		jQuery.ajax("getserviceproviders.php",{
1226
			type: 'post',
1227
			data: {country : jQuery('#country').val()},
1228
			success: function(response) {
1229
				var responseTextArr = response.split("\n");
1230 3a906378 gnhb
				responseTextArr.sort();
1231
				responseTextArr.each( function(value) {
1232
					var option = new Element('option');
1233
					option.text = value;
1234
					option.value = value;
1235 076b14b2 Vinicius Coque
					jQuery('#provider').append(option);
1236 3a906378 gnhb
				});
1237
			}
1238
		});
1239 076b14b2 Vinicius Coque
		jQuery('#trprovider').css("display","table-row");
1240
		jQuery('#trproviderplan').css("display","none");
1241 3a906378 gnhb
	}
1242 c0948c6c Renato Botelho
1243 3a906378 gnhb
	function providerplan_list() {
1244 076b14b2 Vinicius Coque
		jQuery('#providerplan').children().remove();
1245
		jQuery('#providerplan').append( new Element('option') );
1246
		jQuery.ajax("getserviceproviders.php",{
1247
			type: 'post',
1248
			data: {country : jQuery('#country').val(), provider : jQuery('#provider').val()},
1249
			success: function(response) {
1250
				var responseTextArr = response.split("\n");
1251 3a906378 gnhb
				responseTextArr.sort();
1252
				responseTextArr.each( function(value) {
1253
					if(value != "") {
1254
						providerplan = value.split(":");
1255 c0948c6c Renato Botelho
1256 3a906378 gnhb
						var option = new Element('option');
1257
						option.text = providerplan[0] + " - " + providerplan[1];
1258
						option.value = providerplan[1];
1259 076b14b2 Vinicius Coque
						jQuery('#providerplan').append(option);
1260 3a906378 gnhb
					}
1261
				});
1262
			}
1263
		});
1264 076b14b2 Vinicius Coque
		jQuery('#trproviderplan').css("display","table-row");
1265 3a906378 gnhb
	}
1266 c0948c6c Renato Botelho
1267 3a906378 gnhb
	function prefill_provider() {
1268 076b14b2 Vinicius Coque
		jQuery.ajax("getserviceproviders.php",{
1269
			type: 'post',
1270
			data: {country : jQuery('#country').val(), provider : jQuery('#provider').val(), plan : jQuery('#providerplan').val()},
1271
			success: function(data,textStatus,response) {
1272 3a906378 gnhb
				var xmldoc = response.responseXML;
1273
				var provider = xmldoc.getElementsByTagName('connection')[0];
1274 076b14b2 Vinicius Coque
				jQuery('#username').val('');
1275
				jQuery('#password').val('');
1276 3a906378 gnhb
				if(provider.getElementsByTagName('apn')[0].firstChild.data == "CDMA") {
1277 076b14b2 Vinicius Coque
					jQuery('#phone').val('#777');
1278
					jQuery('#apn').val('');
1279 3a906378 gnhb
				} else {
1280 076b14b2 Vinicius Coque
					jQuery('#phone').val('*99#');
1281
					jQuery('#apn').val(provider.getElementsByTagName('apn')[0].firstChild.data);
1282 3a906378 gnhb
				}
1283 076b14b2 Vinicius Coque
				username = provider.getElementsByTagName('username')[0].firstChild.data;
1284
				password = provider.getElementsByTagName('password')[0].firstChild.data;
1285
				jQuery('#username').val(username);
1286
				jQuery('#password').val(password);
1287 3a906378 gnhb
			}
1288
		});
1289
	}
1290
1291 5b237745 Scott Ullrich
</script>
1292 58af5941 Scott Ullrich
</head>
1293 886f1f69 Scott Ullrich
	<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
1294
	<?php include("fbegin.inc"); ?>
1295
	<form action="interfaces.php" method="post" name="iform" id="iform">
1296
		<?php if ($input_errors) print_input_errors($input_errors); ?>
1297 a368a026 Ermal Lu?i
		<?php if (is_subsystem_dirty('interfaces')): ?><p>
1298 ea6be4a7 Erik Fonnesbeck
		<?php print_info_box_np(sprintf(gettext("The %s configuration has been changed."),$wancfg['descr'])."<p>".gettext("You must apply the changes in order for them to take effect.")."<p>".gettext("Don't forget to adjust the DHCP Server range if needed after applying."));?><br />
1299 744ea190 Scott Ullrich
		<?php endif; ?>
1300
		<?php if ($savemsg) print_info_box($savemsg); ?>
1301 98f43e13 Scott Ullrich
		<table width="100%" border="0" cellpadding="6" cellspacing="0">
1302 09583657 Scott Ullrich
			<tr>
1303 30ade846 gnhb
				<td id="mainarea">
1304
					<div class="tabcont">
1305 09583657 Scott Ullrich
					<table width="100%" border="0" cellpadding="6" cellspacing="0">
1306
						<tr>
1307 136c598d Carlos Eduardo Ramos
							<td colspan="2" valign="top" class="listtopic"><?=gettext("General configuration"); ?></td>
1308 09583657 Scott Ullrich
						</tr>
1309
						<tr>
1310 136c598d Carlos Eduardo Ramos
							<td width="22%" valign="top" class="vncell"><?=gettext("Enable"); ?></td>
1311 30ade846 gnhb
							<td width="78%" class="vtable">
1312
								<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable'] == true) echo "checked"; ?> onClick="show_allcfg(this);">
1313 136c598d Carlos Eduardo Ramos
							<strong><?=gettext("Enable Interface"); ?></strong>
1314 09583657 Scott Ullrich
							</td>
1315
						</tr>
1316 30ade846 gnhb
					</table>
1317
					<div style="display:none;" name="allcfg" id="allcfg">
1318
					<table width="100%" border="0" cellpadding="6" cellspacing="0">
1319 09583657 Scott Ullrich
						<tr>
1320 136c598d Carlos Eduardo Ramos
							<td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
1321 09583657 Scott Ullrich
							<td width="78%" class="vtable">
1322 30ade846 gnhb
								<input name="descr" type="text" class="formfld unknown" id="descr" size="30" value="<?=htmlspecialchars($pconfig['descr']);?>">
1323 8cc6876f groo
								<br><span class="vexpl"><?= gettext("Enter a description (name) for the interface here."); ?></span>
1324 30ade846 gnhb
							</td>
1325
						</tr>
1326
						<tr>
1327 e029943a Seth Mos
							<td valign="middle" class="vncell"><strong><?=gettext("IPv4 Configuration Type"); ?></strong></td>
1328 c0948c6c Renato Botelho
							<td class="vtable">
1329 20b49b17 Seth Mos
								<select name="type" onChange="updateType(this.value);" class="formselect" id="type">
1330 c0948c6c Renato Botelho
								<?php
1331 e029943a Seth Mos
									foreach ($types4 as $key => $opt) {
1332 3a13f094 gnhb
										echo "<option onClick=\"updateType('{$key}');\"";
1333 c0948c6c Renato Botelho
										if ($key == $pconfig['type'])
1334 3a13f094 gnhb
											echo " selected";
1335
										echo " value=\"{$key}\" >" . htmlspecialchars($opt);
1336
										echo "</option>";
1337 c0948c6c Renato Botelho
									}
1338 30ade846 gnhb
								?>
1339 667a3184 Scott Ullrich
								</select>
1340 30ade846 gnhb
							</td>
1341
						</tr>
1342 e029943a Seth Mos
						<tr>
1343
							<td valign="middle" class="vncell"><strong><?=gettext("IPv6 Configuration Type"); ?></strong></td>
1344
							<td class="vtable">
1345
								<select name="type6" onChange="updateTypeSix(this.value);" class="formselect" id="type6">
1346
								<?php
1347
									foreach ($types6 as $key => $opt) {
1348
										echo "<option onClick=\"updateTypeSix('{$key}');\"";
1349
										if ($key == $pconfig['type6'])
1350
											echo " selected";
1351
										echo " value=\"{$key}\" >" . htmlspecialchars($opt);
1352
										echo "</option>";
1353
									}
1354
								?>
1355
								</select>
1356
							</td>
1357
						</tr>
1358 30ade846 gnhb
						<tr>
1359 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("MAC address"); ?></td>
1360 30ade846 gnhb
							<td class="vtable">
1361
								<input name="spoofmac" type="text" class="formfld unknown" id="spoofmac" size="30" value="<?=htmlspecialchars($pconfig['spoofmac']);?>">
1362
								<?php
1363
									$ip = getenv('REMOTE_ADDR');
1364
									$mac = `/usr/sbin/arp -an | grep {$ip} | cut -d" " -f4`;
1365
									$mac = str_replace("\n","",$mac);
1366
									if($mac):
1367
								?>
1368 136c598d Carlos Eduardo Ramos
									<a OnClick="document.forms[0].spoofmac.value='<?=$mac?>';" href="#"><?=gettext("Insert my local MAC address"); ?></a>
1369 30ade846 gnhb
								<?php endif; ?>
1370
								<br>
1371 136c598d Carlos Eduardo Ramos
								<?=gettext("This field can be used to modify (\"spoof\") the MAC " .
1372 cf371185 Chris Buechler
								"address of this interface"); ?><br>
1373 136c598d Carlos Eduardo Ramos
								<?=gettext("(may be required with some cable connections)"); ?><br>
1374
								<?=gettext("Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx " .
1375
								"or leave blank"); ?>
1376 30ade846 gnhb
							</td>
1377
						</tr>
1378
						<tr>
1379 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("MTU"); ?></td>
1380 c0948c6c Renato Botelho
							<td class="vtable">
1381 30ade846 gnhb
								<input name="mtu" type="text" class="formfld unknown" id="mtu" size="8" value="<?=htmlspecialchars($pconfig['mtu']);?>">
1382
								<br>
1383 bd6f4dcc jim-p
								<?=gettext("If you leave this field blank, the adapter's default MTU will " .
1384 fcbf8a60 Chris Buechler
								"be used. This is typically 1500 bytes but can vary in some circumstances."); ?>
1385 4cea5cf8 Ermal
							</td>
1386
						</tr>
1387
						<tr>
1388
							<td valign="top" class="vncell"><?=gettext("MSS"); ?></td>
1389 c0948c6c Renato Botelho
							<td class="vtable">
1390 4cea5cf8 Ermal
								<input name="mss" type="text" class="formfld unknown" id="mss" size="8" value="<?=htmlspecialchars($pconfig['mss']);?>">
1391
								<br>
1392 136c598d Carlos Eduardo Ramos
								<?=gettext("If you enter a value in this field, then MSS clamping for " .
1393 c0948c6c Renato Botelho
								"TCP connections to the value entered above minus 40 (TCP/IP " .
1394
								"header size) will be in effect."); ?>
1395 30ade846 gnhb
							</td>
1396
						</tr>
1397 509ca889 Evgeny Yurchenko
						<?php 
1398
						if (count($mediaopts_list) > 0){
1399
						$mediaopt_from_config = $config['interfaces'][$if]['media'] . ' ' . $config['interfaces'][$if]['mediaopt'];
1400
						echo "<tr>";
1401
							echo '<td valign="top" class="vncell">' . gettext("Speed and duplex") . '</td>';
1402
							echo '<td class="vtable">';
1403 6e2a15e6 Evgeny Yurchenko
                                			echo '<div id="showadvmediabox"';
1404
								if ($mediaopt_from_config != 'autoselect ' && $mediaopt_from_config != ' ') echo " style='display:none'>";
1405
								else echo '>';
1406
								echo '<input type="button" onClick="show_advanced_media()" value="' . gettext("Advanced") . '"></input> - ' . gettext("Show advanced option");
1407
							echo "</div>";
1408
							echo '<div id="showmediaadv" ';
1409
							if ($mediaopt_from_config == 'autoselect ' || $mediaopt_from_config == ' ') echo "style='display:none'>";
1410
							else echo '>';
1411 509ca889 Evgeny Yurchenko
								echo '<select name="mediaopt" class="formselect" id="mediaopt">';
1412 433e9842 jim-p
								print "<option value=\"\">Default (no preference, typically autoselect)</option>";
1413
								print "<option value=\"\">------- Media Supported by this interface -------</option>";
1414 509ca889 Evgeny Yurchenko
								foreach($mediaopts_list as $mediaopt){
1415
									if ($mediaopt != rtrim($mediaopt_from_config)){
1416
										print "<option value=\"$mediaopt\">" . gettext("$mediaopt") . "</option>";
1417
									} else {
1418
										print "<option value=\"$mediaopt\" selected>" . gettext("$mediaopt") . "</option>";
1419
									}
1420
								}
1421
								echo '</select><br>';
1422 433e9842 jim-p
								echo gettext("Here you can explicitly set speed and duplex mode for this interface. WARNING: You MUST leave this set to autoselect (automatically negotiate speed) unless the port this interface connects to has its speed and duplex forced.");
1423 6e2a15e6 Evgeny Yurchenko
						echo '</div>';
1424 509ca889 Evgeny Yurchenko
							echo '</td>';
1425
						echo '</tr>';
1426
						}
1427
						?>
1428 30ade846 gnhb
						<tr>
1429
							<td colspan="2" valign="top" height="16"></td>
1430 c0948c6c Renato Botelho
						</tr>
1431 30ade846 gnhb
						<tr style="display:none;" name="none" id="none">
1432
						</tr>
1433 47593ac6 Seth Mos
						<tr style="display:none;" name="staticv4" id="staticv4">
1434 30ade846 gnhb
							<td colspan="2" style="padding:0px;">
1435
								<table width="100%" border="0" cellpadding="6" cellspacing="0">
1436
									<tr>
1437 47593ac6 Seth Mos
										<td colspan="2" valign="top" class="listtopic"><?=gettext("Static IPv4 configuration"); ?></td>
1438 30ade846 gnhb
									</tr>
1439
									<tr>
1440 47593ac6 Seth Mos
										<td width="22%" valign="top" class="vncellreq"><?=gettext("IPv4 address"); ?></td>
1441 c0948c6c Renato Botelho
										<td width="78%" class="vtable">
1442 30ade846 gnhb
											<input name="ipaddr" type="text" class="formfld unknown" id="ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>">
1443
											/
1444
											<select name="subnet" class="formselect" id="subnet">
1445
												<?php
1446
												for ($i = 32; $i > 0; $i--) {
1447
													if($i <> 31) {
1448
														echo "<option value=\"{$i}\" ";
1449
														if ($i == $pconfig['subnet']) echo "selected";
1450
														echo ">" . $i . "</option>";
1451
													}
1452
												}
1453
												?>
1454
											</select>
1455
										</td>
1456
									</tr>
1457
									<tr>
1458 6d3fd938 Seth Mos
										<td width="22%" valign="top" class="vncell"><?=gettext("Gateway"); ?></td>
1459 30ade846 gnhb
										<td width="78%" class="vtable">
1460
											<select name="gateway" class="formselect" id="gateway">
1461 136c598d Carlos Eduardo Ramos
												<option value="none" selected><?=gettext("None"); ?></option>
1462 9978e156 gnhb
													<?php
1463 30ade846 gnhb
													if(count($a_gateways) > 0) {
1464
														foreach ($a_gateways as $gateway) {
1465 47593ac6 Seth Mos
															if(($gateway['interface'] == $if)  && (is_ipaddrv4($gateway['gateway']))) {
1466 9978e156 gnhb
													?>
1467 30ade846 gnhb
															<option value="<?=$gateway['name'];?>" <?php if ($gateway['name'] == $pconfig['gateway']) echo "selected"; ?>>
1468
																<?=htmlspecialchars($gateway['name']) . " - " . htmlspecialchars($gateway['gateway']);?>
1469
															</option>
1470
													<?php
1471
															}
1472
														}
1473
													}
1474
													?>
1475
											</select>
1476 6d3fd938 Seth Mos
											- or  <strong><a OnClick="show_add_gateway();" href="#"><?=gettext("add a new one."); ?></a></strong>
1477 30ade846 gnhb
											<br/>
1478
											<div id='addgwbox'>
1479 6d3fd938 Seth Mos
												<?=gettext("If this interface is an Internet connection, select an existing Gateway from the list or add one using the link above"); ?>
1480 30ade846 gnhb
											</div>
1481
											<div id='notebox'>
1482
											</div>
1483
											<div id="status">
1484 c0948c6c Renato Botelho
											</div>
1485 30ade846 gnhb
											<div style="display:none" id="addgateway" name="addgateway">
1486 c0948c6c Renato Botelho
												<p>
1487 30ade846 gnhb
												<table border="1" style="background:#990000; border-style: none none none none; width:225px;">
1488 9978e156 gnhb
													<tr>
1489 30ade846 gnhb
														<td>
1490
															<table bgcolor="#990000" cellpadding="1" cellspacing="1">
1491
																<tr><td>&nbsp;</td>
1492
																<tr>
1493 933ea015 Carlos Eduardo Ramos
																	<td colspan="2"><center><b><font color="white"><?=gettext("Add new gateway:"); ?></font></b></center></td>
1494 30ade846 gnhb
																</tr>
1495
																<tr><td>&nbsp;</td>
1496
																<?php
1497
																if($if == "wan" || $if == "WAN")
1498
																	$checked = " CHECKED";
1499
																?>
1500
																<tr>
1501 933ea015 Carlos Eduardo Ramos
																	<td width="45%" align="right"><font color="white"><?=gettext("Default  gateway:"); ?></td><td><input type="checkbox" id="defaultgw" name="defaultgw"<?=$checked?>></td>
1502 c0948c6c Renato Botelho
																</tr>
1503 30ade846 gnhb
																<tr>
1504 933ea015 Carlos Eduardo Ramos
																	<td align="right"><font color="white"><?=gettext("Gateway Name:"); ?></td><td><input id="name" name="name" value="<?=$wancfg['descr'] . "GW"?>"></td>
1505 30ade846 gnhb
																</tr>
1506
																<tr>
1507 47593ac6 Seth Mos
																	<td align="right"><font color="white"><?=gettext("Gateway IPv4:"); ?></td><td><input id="gatewayip" name="gatewayip"></td>
1508 30ade846 gnhb
																</tr>
1509
																<tr>
1510 933ea015 Carlos Eduardo Ramos
																	<td align="right"><font color="white"><?=gettext("Description:"); ?></td><td><input id="gatewaydescr" name="gatewaydescr"></td>
1511 30ade846 gnhb
																</tr>
1512
																<tr><td>&nbsp;</td>
1513
																<tr>
1514 7b8db0c3 Erik Fonnesbeck
																	<td>&nbsp;</td>
1515
																	<td>
1516 30ade846 gnhb
																		<center>
1517
																			<div id='savebuttondiv'>
1518 32764288 Namezero
1519 cb3c3fe4 Namezero
1520 c0948c6c Renato Botelho
																				<input id="gwsave" type="Button" value="<?=gettext("Save Gateway"); ?>" onClick='hide_add_gatewaysave();'>
1521 136c598d Carlos Eduardo Ramos
																				<input id="gwcancel" type="Button" value="<?=gettext("Cancel"); ?>" onClick='hide_add_gateway();'>
1522 30ade846 gnhb
																			</div>
1523
																		</center>
1524
																	</td>
1525
																</tr>
1526 93ee6323 gnhb
																<tr><td>&nbsp;</td></tr>
1527 30ade846 gnhb
															</table>
1528 9978e156 gnhb
														</td>
1529
													</tr>
1530
												</table>
1531 30ade846 gnhb
												<p/>
1532
											</div>
1533
										</td>
1534
									</tr>
1535
								</table>
1536
							</td>
1537
						</tr>
1538 47593ac6 Seth Mos
						<tr style="display:none;" name="staticv6" id="staticv6">
1539
							<td colspan="2" style="padding:0px;">
1540
								<table width="100%" border="0" cellpadding="6" cellspacing="0">
1541 56f024e8 Scott Ullrich
									<tr>
1542
										<td colspan="2" valign="top">&nbsp;</td>
1543
									</tr>
1544 47593ac6 Seth Mos
									<tr>
1545
										<td colspan="2" valign="top" class="listtopic"><?=gettext("Static IPv6 configuration"); ?></td>
1546
									</tr>
1547
									<tr>
1548
										<td width="22%" valign="top" class="vncellreq"><?=gettext("IPv6 address"); ?></td>
1549
										<td width="78%" class="vtable">
1550 a8fe61f1 Darren Embry
											<input name="ipaddrv6" type="text" class="formfld unknown ipv4v6" id="ipaddrv6" size="28" value="<?=htmlspecialchars($pconfig['ipaddrv6']);?>">
1551 47593ac6 Seth Mos
											/
1552 a8fe61f1 Darren Embry
											<select name="subnetv6" class="formselect ipv4v6" id="subnetv6">
1553 47593ac6 Seth Mos
												<?php
1554
												for ($i = 128; $i > 0; $i--) {
1555
													if($i <> 127) {
1556
														echo "<option value=\"{$i}\" ";
1557
														if ($i == $pconfig['subnetv6']) echo "selected";
1558
														echo ">" . $i . "</option>";
1559
													}
1560
												}
1561
												?>
1562
											</select>
1563
										</td>
1564
									</tr>
1565
									<tr>
1566 6d3fd938 Seth Mos
										<td width="22%" valign="top" class="vncell"><?=gettext("Gateway IPv6"); ?></td>
1567 47593ac6 Seth Mos
										<td width="78%" class="vtable">
1568
											<select name="gatewayv6" class="formselect" id="gatewayv6">
1569
												<option value="none" selected><?=gettext("None"); ?></option>
1570
													<?php
1571
													if(count($a_gateways) > 0) {
1572
														foreach ($a_gateways as $gateway) {
1573
															if(($gateway['interface'] == $if) && (is_ipaddrv6($gateway['gateway']))) {
1574
													?>
1575
															<option value="<?=$gateway['name'];?>" <?php if ($gateway['name'] == $pconfig['gatewayv6']) echo "selected"; ?>>
1576
																<?=htmlspecialchars($gateway['name']) . " - " . htmlspecialchars($gateway['gateway']);?>
1577
															</option>
1578
													<?php
1579
															}
1580
														}
1581
													}
1582
													?>
1583
											</select>
1584 6d3fd938 Seth Mos
											- or <strong><a OnClick="show_add_gateway_v6();" href="#"><?=gettext("add a new one."); ?></a></strong>
1585 47593ac6 Seth Mos
											<br/>
1586 cfd40454 Seth Mos
											<div id='addgwboxv6'>
1587 6d3fd938 Seth Mos
											<?=gettext("If this interface is an Internet connection, select an existing Gateway from the list or add a new one using the link above"); ?>
1588 47593ac6 Seth Mos
											</div>
1589 cfd40454 Seth Mos
											<div id='noteboxv6'>
1590 47593ac6 Seth Mos
											</div>
1591 cfd40454 Seth Mos
											<div id="statusv6">
1592 47593ac6 Seth Mos
											</div>
1593 cfd40454 Seth Mos
											<div style="display:none" id="addgatewayv6" name="addgatewayv6">
1594 47593ac6 Seth Mos
												<p>
1595
												<table border="1" style="background:#990000; border-style: none none none none; width:225px;">
1596
													<tr>
1597
														<td>
1598
															<table bgcolor="#990000" cellpadding="1" cellspacing="1">
1599
																<tr><td>&nbsp;</td>
1600
																<tr>
1601
																	<td colspan="2"><center><b><font color="white"><?=gettext("Add new v6 gateway:"); ?></font></b></center></td>
1602
																</tr>
1603
																<tr><td>&nbsp;</td>
1604
																<?php
1605
																if($if == "wan" || $if == "WAN")
1606
																	$checked = " CHECKED";
1607
																?>
1608
																<tr>
1609
																	<td width="45%" align="right"><font color="white"><?=gettext("Default v6 gateway:"); ?></td><td><input type="checkbox" id="defaultgwv6" name="defaultgwv6"<?=$checked?>></td>
1610
																</tr>
1611
																<tr>
1612 cfd40454 Seth Mos
																	<td align="right"><font color="white"><?=gettext("Gateway Name IPv6:"); ?></td><td><input id="namev6" name="namev6" value="<?=$wancfg['descr'] . "GWv6"?>"></td>
1613 47593ac6 Seth Mos
																</tr>
1614
																<tr>
1615 cfd40454 Seth Mos
																	<td align="right"><font color="white"><?=gettext("Gateway IPv6:"); ?></td><td><input id="gatewayipv6" name="gatewayipv6"></td>
1616 47593ac6 Seth Mos
																</tr>
1617
																<tr>
1618 cfd40454 Seth Mos
																	<td align="right"><font color="white"><?=gettext("Description:"); ?></td><td><input id="gatewaydescrv6" name="gatewaydescrv6"></td>
1619 47593ac6 Seth Mos
																</tr>
1620
																<tr><td>&nbsp;</td>
1621
																<tr>
1622
																	<td>&nbsp;</td>
1623
																	<td>
1624
																		<center>
1625 cfd40454 Seth Mos
																			<div id='savebuttondivv6'>
1626
																				<input id="gwsavev6" type="Button" value="<?=gettext("Save Gateway"); ?>" onClick='hide_add_gatewaysave_v6();'>
1627
																				<input id="gwcancelv6" type="Button" value="<?=gettext("Cancel"); ?>" onClick='hide_add_gateway_v6();'>
1628 47593ac6 Seth Mos
																			</div>
1629
																		</center>
1630
																	</td>
1631
																</tr>
1632
																<tr><td>&nbsp;</td></tr>
1633
															</table>
1634
														</td>
1635
													</tr>
1636
												</table>
1637
												<p/>
1638
											</div>
1639
										</td>
1640
									</tr>
1641
								</table>
1642
							</td>
1643
						</tr>
1644 30ade846 gnhb
						<tr style="display:none;" name="dhcp" id="dhcp">
1645
							<td colspan="2" style="padding: 0px;">
1646
								<table width="100%" border="0" cellpadding="6" cellspacing="0">
1647
									<tr>
1648 a9543eae Seth Mos
										<td colspan="2" valign="top" class="listtopic"><?=gettext("DHCP client configuration"); ?></td>
1649 30ade846 gnhb
									</tr>
1650 e4d40f41 gnhb
									<!-- Uncomment to expose DHCP+ in GUI
1651
									<tr>
1652
										<td width="22%" valign="top" class="vncell"><?=gettext("Enable DHCP+"); ?></td>
1653
										<td width="78%" class="vtable">
1654
											<input name="dhcp_plus" type="checkbox" value="yes" <?php if ($pconfig['dhcp_plus'] == true) echo "checked"; ?> >
1655
										<strong><?=gettext("Enable DHCP+L2TP or DHCP+PPTP."); ?></strong>
1656
										<br/>
1657
										<?=gettext("Status changes on this interface will trigger reconfiguration (if necessary) of the associated PPTP/L2TP link."); ?>
1658
										</td>
1659
									</tr>
1660
									-->
1661 30ade846 gnhb
									<tr>
1662 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Hostname"); ?></td>
1663 30ade846 gnhb
										<td width="78%" class="vtable">
1664
											<input name="dhcphostname" type="text" class="formfld unknown" id="dhcphostname" size="40" value="<?=htmlspecialchars($pconfig['dhcphostname']);?>">
1665
											<br>
1666 136c598d Carlos Eduardo Ramos
											<?=gettext("The value in this field is sent as the DHCP client identifier " .
1667
											"and hostname when requesting a DHCP lease. Some ISPs may require " .
1668 933ea015 Carlos Eduardo Ramos
											"this (for client identification)."); ?>
1669 30ade846 gnhb
										</td>
1670
									</tr>
1671 ed395640 Seth Mos
									<tr>
1672
										<td width="22%" valign="top" class="vncell"><?=gettext("Alias IPv4 address"); ?></td>
1673
										<td width="78%" class="vtable">
1674
											<input name="alias-address" type="text" class="formfld unknown" id="alias-address" size="20" value="<?=htmlspecialchars($pconfig['alias-address']);?>">
1675
											<select name="alias-subnet" class="formselect" id="alias-subnet">
1676
												<?php
1677
												for ($i = 32; $i > 0; $i--) {
1678
													if($i <> 31) {
1679
														echo "<option value=\"{$i}\" ";
1680
														if ($i == $pconfig['alias-subnet']) echo "selected";
1681
														echo ">" . $i . "</option>";
1682
													}
1683
												}
1684
												?>
1685
											</select>
1686
											<?=gettext("The value in this field is used as a fixed alias IPv4 address by the " .
1687
											"DHCP client."); ?>
1688
										</td>
1689 bfab2419 smos
									</tr>
1690 e029943a Seth Mos
								</table>
1691
							</td>
1692
						</tr>
1693
						<tr style="display:none;" name="dhcp6" id="dhcp6">
1694
							<td colspan="2" style="padding: 0px;">
1695
								<table width="100%" border="0" cellpadding="6" cellspacing="0">
1696
									<tr>
1697
										<td colspan="2" valign="top" class="listtopic"><?=gettext("DHCP6 client configuration"); ?></td>
1698 ed395640 Seth Mos
									</tr>
1699 20a7cb15 smos
									<!--- Leave commented out for now
1700 a9543eae Seth Mos
									<tr>
1701
										<td width="22%" valign="top" class="vncell"><?=gettext("DHCPv6 Unique Identifier (DUID)"); ?></td>
1702
										<td width="78%" class="vtable">
1703 ed395640 Seth Mos
											<input name="dhcp6-duid" type="text" class="formfld unknown" id="dhcp6-duid" size="40" value="<?=htmlspecialchars($pconfig['dhcp6-duid']);?>">
1704 a9543eae Seth Mos
											<br>
1705
											<?=gettext("The value in this field is sent as the DHCPv6 client identifier " .
1706 7149c4e7 Seth Mos
											"when requesting a DHCPv6 lease."); ?><br />
1707
											<?php	if(is_readable("/var/db/dhcp6c_duid")) {
1708 ed395640 Seth Mos
													// $current_duid = file_get_contents("/var/db/dhcp6c_duid");
1709 7149c4e7 Seth Mos
												}
1710 b1e4005f Vinicius Coque
												printf(gettext("The current DUID is: '%s'"),$current_duid);
1711 bfab2419 smos
												// hexdump -e '"%07.7_ax " 1/2 "%04x" " " 14/1 "%02x:" "\n"'
1712 7149c4e7 Seth Mos
											?>
1713
										</td>
1714
									</tr>
1715 20a7cb15 smos
									-->
1716 7149c4e7 Seth Mos
									<tr>
1717
										<td width="22%" valign="top" class="vncell"><?=gettext("DHCPv6 Prefix Delegation size"); ?></td>
1718
										<td width="78%" class="vtable">
1719 ed395640 Seth Mos
											<select name="dhcp6-ia-pd-len" class="formselect" id="dhcp6-ia-pd-len">
1720 7149c4e7 Seth Mos
												<?php
1721 ed395640 Seth Mos
												$sizes = array("none" => "None", 16 => "48", 12 => "52", 8 => "56", 4 => "60", 2 => "62", 1 => "63", 0 => "64");
1722 7149c4e7 Seth Mos
												foreach($sizes as $bits => $length) {
1723
													echo "<option value=\"{$bits}\" ";
1724 ed395640 Seth Mos
													if (is_numeric($pconfig['dhcp6-ia-pd-len']) && ($bits == $pconfig['dhcp6-ia-pd-len'])) echo "selected";
1725 7149c4e7 Seth Mos
													echo ">" . $length . "</option>";
1726
												}
1727
												?>
1728
											</select>
1729
											<br>
1730 ed395640 Seth Mos
											<?=gettext("The value in this field is the delegated prefix length provided by the DHCPv6 server. Normally specified by the ISP."); ?>
1731 30ade846 gnhb
										</td>
1732
									</tr>
1733 47593ac6 Seth Mos
								</table>
1734
							</td>
1735
						</tr>
1736 adc91ab7 smos
						<tr style="display:none;" name="6rd" id="6rd">
1737 7d567088 smos
							<td colspan="2" style="padding: 0px;">
1738
								<table width="100%" border="0" cellpadding="6" cellspacing="0">
1739
									<tr>
1740
										<td colspan="2" valign="top" class="listtopic"><?=gettext("6RD Rapid Deployment"); ?></td>
1741
									</tr>
1742
									<tr>
1743
										<td width="22%" valign="top" class="vncell"><?=gettext("6RD prefix"); ?></td>
1744
										<td width="78%" class="vtable">
1745
											<input name="prefix-6rd" type="text" class="formfld unknown" id="prefix-6rd" size="40" value="<?=htmlspecialchars($pconfig['prefix-6rd']);?>">
1746
											<br>
1747 32dc8109 smos
											<?=gettext("The value in this field is the 6RD IPv6 prefix assigned by your ISP. e.g. '2001:db8::/32'") ?><br />
1748 7d567088 smos
										</td>
1749
									</tr>
1750
									<tr>
1751 12215bfb smos
										<td width="22%" valign="top" class="vncell"><?=gettext("6RD Border Relay"); ?></td>
1752 7d567088 smos
										<td width="78%" class="vtable">
1753
											<input name="gateway-6rd" type="text" class="formfld unknown" id="gateway-6rd" size="40" value="<?=htmlspecialchars($pconfig['gateway-6rd']);?>">
1754
											<br>
1755 32dc8109 smos
											<?=gettext("The value in this field is 6RD IPv4 gateway address assigned by your ISP") ?><br />
1756 7d567088 smos
										</td>
1757
									</tr>
1758
									<tr>
1759 12215bfb smos
										<td width="22%" valign="top" class="vncell"><?=gettext("6RD IPv4 Prefix length"); ?></td>
1760 7d567088 smos
										<td width="78%" class="vtable">
1761 12215bfb smos
											<select name="prefix-6rd-v4plen" class="formselect" id="prefix-6rd-v4plen">
1762 7d567088 smos
												<?php
1763 12215bfb smos
												for ($i = 0; $i < 32; $i++) {
1764
													echo "<option value=\"{$i}\" ";
1765
													if (is_numeric($pconfig['prefix-6rd-v4plen']) && ($i == $pconfig['prefix-6rd-v4plen'])) echo "selected";
1766
													echo ">" . $i . " bits</option>";
1767 7d567088 smos
												}
1768
												?>
1769
											</select>
1770
											<br>
1771 12215bfb smos
											<?=gettext("The value in this field is the 6RD IPv4 prefix length. Normally specified by the ISP. A value of 0 means we embed the entire IPv4 address in the 6RD prefix."); ?>
1772 7d567088 smos
										</td>
1773
									</tr>
1774
								</table>
1775
							</td>
1776
						</tr>
1777 20a7cb15 smos
						<tr style="display:none;" name="track6" id="track6">
1778
							<td colspan="2" style="padding: 0px;">
1779
								<table width="100%" border="0" cellpadding="6" cellspacing="0">
1780
									<tr>
1781
										<td colspan="2" valign="top" class="listtopic"><?=gettext("Track IPv6 Interface"); ?></td>
1782
									</tr>
1783
									<tr>
1784
										<td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Interface"); ?></td>
1785
										<td width="78%" class="vtable">
1786
										<select name='track6-interface' class='formselect' >
1787
										<?php 
1788
											$interfaces = get_configured_interface_with_descr(false, true);
1789
											$dynv6ifs = array();
1790
											foreach ($interfaces as $iface => $ifacename) {
1791
												switch($config['interfaces'][$iface]['ipaddrv6']) {
1792
													case "6to4":
1793
													case "6rd":
1794
													case "dhcp6":
1795
														$dynv6ifs[$iface] = $ifacename;
1796
														break;
1797
													default:
1798
														continue;
1799
												}
1800
											}
1801
											foreach($dynv6ifs as $iface => $ifacename) {
1802
												echo "<option value=\"{$iface}\"";
1803
												if ($iface == $pconfig['track6-interface'])
1804
													echo " selected";
1805
												echo ">" . htmlspecialchars($ifacename) . "</option>";
1806
											}
1807
										  ?>
1808
										</select> <br>
1809
											<br>
1810
											<?=gettext("This selects the dynamic IPv6 WAN interface to track for configuration") ?><br />
1811
										</td>
1812
									</tr>
1813
									<tr>
1814
										<td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Prefix ID"); ?></td>
1815
										<td width="78%" class="vtable">
1816 6b2d4b5a Darren Embry
											<?php
1817
												if ($pconfig['track6-prefix-id'] == "none" || $pconfig['track6-prefix-id'] == "") {
1818
													$track6_prefix_id_hex = "";
1819
												} else {
1820
													$track6_prefix_id_hex = sprintf("%x", $pconfig['track6-prefix-id']);
1821 20a7cb15 smos
												}
1822 6b2d4b5a Darren Embry
											?>
1823
											<input name="track6-prefix-id--hex" type="text" class="formfld unknown" id="track6-prefix-id--hex" size="8" value="<?= $track6_prefix_id_hex ?>" />
1824
											<br />
1825
											<?= gettext("The value in this field is the (Delegated) IPv6 prefix id. This determines the configurable network ID based on the dynamic IPv6 connection"); ?>
1826
											<br />
1827
											<?= sprintf(gettext("Enter a <b>hexadecimal</b> value between %x and %x here, or leave blank."), 0, $ipv6_num_prefix_ids - 1); ?>
1828 20a7cb15 smos
										</td>
1829
									</tr>
1830
										</td>
1831
									</tr>
1832
								</table>
1833
							</td>
1834
						</tr>
1835 6c05cfb0 gnhb
						<tr style="display:none;" name="ppp" id="ppp">
1836
							<td colspan="2" style="padding: 0px;">
1837
								<table width="100%" border="0" cellpadding="6" cellspacing="0">
1838
									<tr>
1839 136c598d Carlos Eduardo Ramos
										<td colspan="2" valign="top" class="listtopic"><?=gettext("PPP configuration"); ?></td>
1840 6c05cfb0 gnhb
									</tr>
1841 3a906378 gnhb
									<tr name="ppp_provider" id="ppp_provider">
1842 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Service Provider"); ?></td>
1843 3a906378 gnhb
										<td width="78%" class="vtable">
1844
											<table border="0" cellpadding="0" cellspacing="0">
1845
												<tr id="trcountry">
1846 933ea015 Carlos Eduardo Ramos
													<td><?=gettext("Country:"); ?> &nbsp;&nbsp;</td>
1847 3a906378 gnhb
													<td>
1848
														<select class="formselect" name="country" id="country" onChange="providers_list()">
1849
															<option></option>
1850
														</select>
1851
													</td>
1852
												</tr>
1853
												<tr id="trprovider" style="display:none">
1854 933ea015 Carlos Eduardo Ramos
													<td><?=gettext("Provider:"); ?> &nbsp;&nbsp;</td>
1855 3a906378 gnhb
													<td>
1856
														<select class="formselect" name="provider" id="provider" onChange="providerplan_list()">
1857
															<option></option>
1858
														</select>
1859
													</td>
1860
												</tr>
1861
												<tr id="trproviderplan" style="display:none">
1862 933ea015 Carlos Eduardo Ramos
													<td><?=gettext("Plan:"); ?> &nbsp;&nbsp;</td>
1863 3a906378 gnhb
													<td>
1864
														<select class="formselect" name="providerplan" id="providerplan" onChange="prefill_provider()">
1865
															<option></option>
1866
														</select>
1867
													</td>
1868
												</tr>
1869
											</table>
1870 136c598d Carlos Eduardo Ramos
											<br/><span class="vexpl"><?=gettext("Select to fill in data for your service provider."); ?></span>
1871 3a906378 gnhb
										</td>
1872
									</tr>
1873 6c05cfb0 gnhb
									<tr>
1874 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Username"); ?></td>
1875 3a906378 gnhb
										<td width="78%" class="vtable">
1876
										<input name="username" type="text" class="formfld user" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>">
1877
										</td>
1878
									</tr>
1879
									<tr>
1880 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Password"); ?></td>
1881 3a906378 gnhb
										<td width="78%" class="vtable">
1882
										<input name="password" type="password" class="formfld pwd" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>">
1883
										</td>
1884
									</tr>
1885
									<tr name="phone_num" id="phone_num">
1886 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Phone Number"); ?></td>
1887 3a906378 gnhb
										<td width="78%" class="vtable">
1888
											<input name="phone" type="text" class="formfld unknown" id="phone" size="12" value="<?=htmlspecialchars($pconfig['phone']);?>">
1889
										</td>
1890
									</tr>
1891
									<tr name="apn_" id="apn_">
1892 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Access Point Name (APN)"); ?></td>
1893 3a906378 gnhb
										<td width="78%" class="vtable">
1894
											<input name="apn" type="text" class="formfld unknown" id="apn" size="40" value="<?=htmlspecialchars($pconfig['apn']);?>">
1895
										</td>
1896
									</tr>
1897
									<tr name="interface" id="interface" >
1898 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Modem Port"); ?></td>
1899 3a906378 gnhb
										<td width="78%" class="vtable">
1900
											<select name="port" id="port" class="formselect">
1901
											<?php
1902
												$portlist = glob("/dev/cua*");
1903
												$modems = glob("/dev/modem*");
1904
												$portlist = array_merge($portlist, $modems);
1905
												foreach ($portlist as $port) {
1906
													if(preg_match("/\.(lock|init)$/", $port))
1907
														continue;
1908
													echo "<option value=\"".trim($port)."\"";
1909
													if ($pconfig['port'] == $port)
1910
														echo "selected";
1911
													echo ">{$port}</option>";
1912
												}?>
1913
											</select>
1914
										</td>
1915
									</tr>
1916 136c598d Carlos Eduardo Ramos
									<td width="22%" valign="top" class="vncell"><?=gettext("Advanced PPP"); ?></td>
1917 6c05cfb0 gnhb
										<?php if (isset($pconfig['pppid'])): ?>
1918
											<td width="78%" class="vtable">
1919 933ea015 Carlos Eduardo Ramos
											<a href="/interfaces_ppps_edit.php?id=<?=htmlspecialchars($pconfig['pppid']);?>" class="navlnk"><?=gettext("Click here"); ?> </a>
1920
											<?=gettext("to edit PPP configuration."); ?>
1921 6c05cfb0 gnhb
											</td>
1922 ee9933b6 Renato Botelho
										<?php else: ?>
1923 6c05cfb0 gnhb
											<td width="78%" class="vtable">
1924 933ea015 Carlos Eduardo Ramos
											<a href="/interfaces_ppps_edit.php" class="navlnk"><?=gettext("Click here"); ?> </a>
1925
											<?=gettext("to create a PPP configuration."); ?>
1926 6c05cfb0 gnhb
											</td>
1927 c0948c6c Renato Botelho
										<?php endif; ?>
1928 6c05cfb0 gnhb
									</tr>
1929
								</table>
1930
							</td>
1931
						</tr>
1932 30ade846 gnhb
						<tr style="display:none;" name="pppoe" id="pppoe">
1933
							<td colspan="2" style="padding:0px;">
1934
								<table width="100%" border="0" cellpadding="6" cellspacing="0">
1935
									<tr>
1936 136c598d Carlos Eduardo Ramos
										<td colspan="2" valign="top" class="listtopic"><?=gettext("PPPoE configuration"); ?></td>
1937 30ade846 gnhb
									</tr>
1938
									<tr>
1939 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Username"); ?></td>
1940 30ade846 gnhb
										<td width="78%" class="vtable">
1941
												<input name="pppoe_username" type="text" class="formfld user" id="pppoe_username" size="20" value="<?=htmlspecialchars($pconfig['pppoe_username']);?>">
1942
										</td>
1943
									</tr>
1944
									<tr>
1945 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Password"); ?></td>
1946 30ade846 gnhb
										<td width="78%" class="vtable">
1947
											<input name="pppoe_password" type="password" class="formfld pwd" id="pppoe_password" size="20" value="<?=htmlspecialchars($pconfig['pppoe_password']);?>">
1948
										</td>
1949
									</tr>
1950
									<tr>
1951 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Service name"); ?></td>
1952 30ade846 gnhb
										<td width="78%" class="vtable"><input name="provider" type="text" class="formfld unknown" id="provider" size="20" value="<?=htmlspecialchars($pconfig['provider']);?>">
1953 136c598d Carlos Eduardo Ramos
											<br> <span class="vexpl"><?=gettext("Hint: this field can usually be left empty"); ?></span>
1954 30ade846 gnhb
										</td>
1955
									</tr>
1956
									<tr>
1957 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Dial on demand"); ?></td>
1958 30ade846 gnhb
										<td width="78%" class="vtable">
1959
											<input name="pppoe_dialondemand" type="checkbox" id="pppoe_dialondemand" value="enable" <?php if ($pconfig['pppoe_dialondemand']) echo "checked"; ?>>
1960 136c598d Carlos Eduardo Ramos
											<strong><?=gettext("Enable Dial-On-Demand mode"); ?></strong><br>
1961 933ea015 Carlos Eduardo Ramos
											<?=gettext("This option causes the interface to operate in dial-on-demand mode, allowing you to have a "); ?><i><?=gettext("virtual full time"); ?></i> <?=gettext("connection. The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected."); ?>
1962 30ade846 gnhb
										</td>
1963
									</tr>
1964
									<tr>
1965 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Idle timeout"); ?></td>
1966 30ade846 gnhb
										<td width="78%" class="vtable">
1967 933ea015 Carlos Eduardo Ramos
											<input name="pppoe_idletimeout" type="text" class="formfld unknown" id="pppoe_idletimeout" size="8" value="<?=htmlspecialchars($pconfig['pppoe_idletimeout']);?>"> <?=gettext("seconds"); ?><br><?=gettext("If no qualifying outgoing packets are transmitted for the specified number of seconds, the connection is brought down. An idle timeout of zero disables this feature."); ?>
1968 30ade846 gnhb
										</td>
1969
									</tr>
1970
									<tr>
1971
										<td width="22%" valign="top" class="vncell"><?=gettext("Periodic reset");?></td>
1972
										<td width="78%" class="vtable">
1973
											<table id="presetwrap" cellspacing="0" cellpadding="0" width="100%">
1974
												<tr>
1975
													<td align="left" valign="top">
1976
														<p style="margin: 4px; padding: 4px 0 4px 0; width: 94%;">
1977
														<select valign="top" id="reset_type" name="pppoe-reset-type" class="formselect" onChange="show_reset_settings(this.value);">
1978 136c598d Carlos Eduardo Ramos
															<option value = ""><?=gettext("Disabled"); ?></option>
1979
															<option value="custom" <?php if ($pconfig['pppoe-reset-type'] == "custom") echo "selected"; ?>><?=gettext("Custom"); ?></option>
1980
															<option value="preset" <?php if ($pconfig['pppoe-reset-type'] == "preset") echo "selected"; ?>><?=gettext("Pre-Set"); ?></option>
1981
														</select> <?=gettext("Select a reset timing type"); ?>
1982 30ade846 gnhb
														</p>
1983
														<?php if ($pconfig['pppoe_pr_custom']): ?>
1984
															<p style="margin: 2px; padding: 4px; width: 94%;" id="pppoecustomwrap">
1985
														<?php else: ?>
1986
															<p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoecustomwrap">
1987
														<?php endif; ?>
1988 c0948c6c Renato Botelho
														<input type="text" name="pppoe_resethour" class="fd_incremental_inp_range_0_23 fd_increment_1 fd_classname_dec_buttonDec fd_classname_inc_buttonInc" maxlength="2" id="pppoe_resethour" value="<?= $pconfig['pppoe_resethour']; ?>" size="3" />
1989 136c598d Carlos Eduardo Ramos
														<?=gettext("hour (0-23)"); ?><br />
1990 c0948c6c Renato Botelho
														<input type="text" name="pppoe_resetminute" class="fd_incremental_inp_range_0_59 fd_increment_1 fd_classname_dec_buttonDec fd_classname_inc_buttonInc" maxlength="2" id="pppoe_resetminute" value="<?= $pconfig['pppoe_resetminute']; ?>" size="3" />
1991 136c598d Carlos Eduardo Ramos
														<?=gettext("minute (0-59)"); ?><br />
1992 c0948c6c Renato Botelho
														<input name="pppoe_resetdate" type="text" class="w8em format-m-d-y highlight-days-67" id="pppoe_resetdate" maxlength="10" size="10" value="<?=htmlspecialchars($pconfig['pppoe_resetdate']);?>" />
1993 136c598d Carlos Eduardo Ramos
														<?=gettext("reset at a specific date (mm/dd/yyyy)"); ?>
1994 30ade846 gnhb
														<br />&nbsp;<br />
1995 933ea015 Carlos Eduardo Ramos
														<span class="red"><strong><?=gettext("Note:"); ?> </strong></span>
1996 136c598d Carlos Eduardo Ramos
														<?=gettext("If you leave the date field empty, the reset will be executed each day at the time you did specify using the minutes and hour field."); ?>
1997 30ade846 gnhb
														</p>
1998
														<?php if ($pconfig['pppoe_pr_preset']): ?>
1999
															<p style="margin: 2px; padding: 4px; width: 94%;" id="pppoepresetwrap">
2000
														<?php else: ?>
2001
															<p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoepresetwrap">
2002
														<?php endif; ?>
2003 c0948c6c Renato Botelho
														<input name="pppoe_pr_preset_val" type="radio" id="pppoe_monthly" value="monthly" <?php if ($pconfig['pppoe_monthly']) echo "checked=\"checked\""; ?> />
2004 136c598d Carlos Eduardo Ramos
														<?=gettext("reset at each month ('0 0 1 * *')"); ?>
2005 30ade846 gnhb
														<br />
2006 c0948c6c Renato Botelho
														<input name="pppoe_pr_preset_val" type="radio" id="pppoe_weekly" value="weekly" <?php if ($pconfig['pppoe_weekly']) echo "checked=\"checked\""; ?> />
2007 136c598d Carlos Eduardo Ramos
														<?=gettext("reset at each week ('0 0 * * 0')"); ?>
2008 30ade846 gnhb
														<br />
2009 c0948c6c Renato Botelho
														<input name="pppoe_pr_preset_val" type="radio" id="pppoe_daily" value="daily" <?php if ($pconfig['pppoe_daily']) echo "checked=\"checked\""; ?> />
2010 136c598d Carlos Eduardo Ramos
														<?=gettext("reset at each day ('0 0 * * *')"); ?>
2011 30ade846 gnhb
														<br />
2012 c0948c6c Renato Botelho
														<input name="pppoe_pr_preset_val" type="radio" id="pppoe_hourly" value="hourly" <?php if ($pconfig['pppoe_hourly']) echo "checked=\"checked\""; ?> />
2013 136c598d Carlos Eduardo Ramos
														<?=gettext("reset at each hour ('0 * * * *')"); ?>
2014 30ade846 gnhb
														</p>
2015
													</td>
2016
												</tr>
2017
											</table>
2018
										</td>
2019
									</tr>
2020 c0948c6c Renato Botelho
2021 30ade846 gnhb
									<tr>
2022 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Advanced and MLPPP"); ?></td>
2023 30ade846 gnhb
										<?php if (isset($pconfig['pppid'])): ?>
2024 09637075 gnhb
											<td width="78%" class="vtable">
2025 c0948c6c Renato Botelho
											<a href="/interfaces_ppps_edit.php?id=<?=htmlspecialchars($pconfig['pppid']);?>" class="navlnk"><?=gettext("Click here"); ?> </a>
2026 933ea015 Carlos Eduardo Ramos
											<?=gettext("for additional PPPoE configuration options. Save first if you made changes."); ?>
2027 9978e156 gnhb
											</td>
2028 ee9933b6 Renato Botelho
										<?php else: ?>
2029 09637075 gnhb
											<td width="78%" class="vtable">
2030 136c598d Carlos Eduardo Ramos
											<a href="/interfaces_ppps_edit.php" class="navlnk"><?=gettext("Click here"); ?> </a>
2031 933ea015 Carlos Eduardo Ramos
											<?=gettext("for advanced PPPoE configuration options and MLPPP configuration."); ?>
2032 30ade846 gnhb
											</td>
2033 c0948c6c Renato Botelho
										<?php endif; ?>
2034 30ade846 gnhb
									</tr>
2035
								</table>
2036 87f0be87 Chris Buechler
							</td>
2037 667a3184 Scott Ullrich
						</tr>
2038 30ade846 gnhb
						<tr style="display:none;" name="pptp" id="pptp">
2039
							<td colspan="2" style="padding:0px;">
2040
								<table width="100%" border="0" cellpadding="6" cellspacing="0">
2041
									<tr>
2042 e4d40f41 gnhb
										<td colspan="2" valign="top" class="listtopic"><?=gettext("PPTP/L2TP configuration"); ?></td>
2043 30ade846 gnhb
									</tr>
2044
									<tr>
2045 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Username"); ?></td>
2046 30ade846 gnhb
										<td width="78%" class="vtable">
2047
											<input name="pptp_username" type="text" class="formfld user" id="pptp_username" size="20" value="<?=htmlspecialchars($pconfig['pptp_username']);?>">
2048
										</td>
2049
									</tr>
2050
									<tr>
2051 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Password"); ?></td>
2052 30ade846 gnhb
										<td width="78%" class="vtable">
2053 4a1ee8ac gnhb
											<input name="pptp_password" type="password" class="formfld pwd" id="pptp_password" size="20" value="<?=htmlspecialchars($pconfig['pptp_password']);?>">
2054 30ade846 gnhb
										</td>
2055
									</tr>
2056
									<tr>
2057 136c598d Carlos Eduardo Ramos
										<td width="22%" width="100" valign="top" class="vncellreq"><?=gettext("Local IP address"); ?></td>
2058 c0948c6c Renato Botelho
										<td width="78%" class="vtable">
2059 4a1ee8ac gnhb
											<input name="pptp_local" type="text" class="formfld unknown" id="pptp_local" size="20"  value="<?=htmlspecialchars($pconfig['pptp_local'][0]);?>">
2060 30ade846 gnhb
											/
2061
											<select name="pptp_subnet" class="formselect" id="pptp_subnet">
2062
												<?php for ($i = 31; $i > 0; $i--): ?>
2063 4a1ee8ac gnhb
													<option value="<?=$i;?>" <?php if ($i == $pconfig['pptp_subnet'][0]) echo "selected"; ?>>
2064 30ade846 gnhb
														<?=$i;?></option>
2065
												<?php endfor; ?>
2066
											</select>
2067
										</td>
2068
									</tr>
2069
									<tr>
2070 136c598d Carlos Eduardo Ramos
										<td width="22%" width="100" valign="top" class="vncellreq"><?=gettext("Remote IP address"); ?></td>
2071 30ade846 gnhb
										<td width="78%" class="vtable">
2072 4a1ee8ac gnhb
											<input name="pptp_remote" type="text" class="formfld unknown" id="pptp_remote" size="20" value="<?=htmlspecialchars($pconfig['pptp_remote'][0]);?>">
2073 30ade846 gnhb
										</td>
2074
									</tr>
2075
									<tr>
2076 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Dial on demand"); ?></td>
2077 30ade846 gnhb
										<td width="78%" class="vtable">
2078
											<input name="pptp_dialondemand" type="checkbox" id="pptp_dialondemand" value="enable" <?php if ($pconfig['pptp_dialondemand']) echo "checked"; ?>>
2079 136c598d Carlos Eduardo Ramos
											<strong><?=gettext("Enable Dial-On-Demand mode"); ?></strong><br>
2080 933ea015 Carlos Eduardo Ramos
											<?=gettext("This option causes the interface to operate in dial-on-demand mode, allowing you to have a"); ?> <i><?=gettext("virtual full time"); ?></i> <?=gettext("connection. The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected."); ?>
2081 30ade846 gnhb
										</td>
2082
									</tr>
2083
									<tr>
2084 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Idle timeout"); ?></td>
2085 30ade846 gnhb
										<td width="78%" class="vtable">
2086 933ea015 Carlos Eduardo Ramos
											<input name="pptp_idletimeout" type="text" class="formfld unknown" id="pptp_idletimeout" size="8" value="<?=htmlspecialchars($pconfig['pptp_idletimeout']);?>"> <?=gettext("seconds"); ?><br><?=gettext("If no qualifying outgoing packets are transmitted for the specified number of seconds, the connection is brought down. An idle timeout of zero disables this feature."); ?>
2087 30ade846 gnhb
										</td>
2088
									</tr>
2089 4a1ee8ac gnhb
									<tr>
2090 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Advanced"); ?></td>
2091 4a1ee8ac gnhb
										<?php if (isset($pconfig['pppid'])): ?>
2092
											<td width="78%" class="vtable">
2093 c0948c6c Renato Botelho
											<a href="/interfaces_ppps_edit.php?id=<?=htmlspecialchars($pconfig['pppid']);?>" class="navlnk"><?=gettext("Click here");?></a>
2094 933ea015 Carlos Eduardo Ramos
											<?=gettext("for additional PPTP and L2TP configuration options. Save first if you made changes.");?>
2095 4a1ee8ac gnhb
											</td>
2096 ee9933b6 Renato Botelho
										<?php else: ?>
2097 4a1ee8ac gnhb
											<td width="78%" class="vtable">
2098 4256d115 Renato Botelho
											<a href="/interfaces_ppps_edit.php" class="navlnk"><?=gettext("Click here");?></a>
2099
											<?=gettext("for advanced PPTP and L2TP configuration options");?>.
2100 4a1ee8ac gnhb
											</td>
2101 c0948c6c Renato Botelho
										<?php endif; ?>
2102 4a1ee8ac gnhb
									</tr>
2103 30ade846 gnhb
								</table>
2104
							</td>
2105
						</tr>
2106
						<?php
2107
							/* Wireless interface? */
2108
							if (isset($wancfg['wireless'])):
2109
						?>
2110
						<tr>
2111
							<td colspan="2" valign="top" height="16"></td>
2112 c0948c6c Renato Botelho
						</tr>
2113 9978e156 gnhb
						<tr>
2114 136c598d Carlos Eduardo Ramos
							<td colspan="2" valign="top" class="listtopic"><?=gettext("Common wireless configuration - Settings apply to all wireless networks on"); ?> <?=$wlanbaseif;?>.</td>
2115 9978e156 gnhb
						</tr>
2116 f62c44d8 Erik Fonnesbeck
						<tr>
2117 4256d115 Renato Botelho
							<td valign="top" class="vncell"><?=gettext("Persist common settings");?></td>
2118 f62c44d8 Erik Fonnesbeck
							<td class="vtable">
2119 ee9933b6 Renato Botelho
								<input name="persistcommonwireless" type="checkbox" value="yes"  class="formfld" id="persistcommonwireless" <?php if ($pconfig['persistcommonwireless']) echo "checked";?>>
2120 933ea015 Carlos Eduardo Ramos
								<br/><?=gettext("Enabling this preserves the common wireless configuration through interface deletions and reassignments.");?>
2121 f62c44d8 Erik Fonnesbeck
							</td>
2122
						</tr>
2123 9978e156 gnhb
						<tr>
2124 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncellreq"><?=gettext("Standard"); ?></td>
2125 30ade846 gnhb
							<td class="vtable">
2126 3a13f094 gnhb
							<select name="standard" class="formselect" id="standard">
2127
								<?php
2128
								foreach($wl_modes as $wl_standard => $wl_channels) {
2129
									echo "<option ";
2130
									if ($pconfig['standard'] == "$wl_standard")
2131
										echo "selected ";
2132
									echo "value=\"$wl_standard\">802.$wl_standard</option>\n";
2133
								}
2134
								?>
2135
							</select>
2136 30ade846 gnhb
							</td>
2137
						</tr>
2138
						<?php if (isset($wl_modes['11g'])): ?>
2139
						<tr>
2140 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncellreq">802.11g OFDM <?=gettext("Protection Mode"); ?></td>
2141 30ade846 gnhb
							<td class="vtable">
2142
								<select name="protmode" class="formselect" id="protmode">
2143 ee9933b6 Renato Botelho
									<option <?php if ($pconfig['protmode'] == 'off') echo "selected";?> value="off"><?=gettext("Protection mode off"); ?></option>
2144
									<option <?php if ($pconfig['protmode'] == 'cts') echo "selected";?> value="cts"><?=gettext("Protection mode CTS to self"); ?></option>
2145
									<option <?php if ($pconfig['protmode'] == 'rtscts') echo "selected";?> value="rtscts"><?=gettext("Protection mode RTS and CTS"); ?></option>
2146 30ade846 gnhb
								</select>
2147
								<br/>
2148 933ea015 Carlos Eduardo Ramos
								<?=gettext("For IEEE 802.11g, use the specified technique for protecting OFDM frames in a mixed 11b/11g network."); ?>
2149 30ade846 gnhb
								<br/>
2150
							</td>
2151
						</tr>
2152
						<?php else: ?>
2153
						<input name="protmode" type="hidden" id="protmode" value="off">
2154
						<?php endif; ?>
2155
						<tr>
2156 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncellreq"><?=gettext("Transmit power"); ?></td>
2157 30ade846 gnhb
							<td class="vtable">
2158
								<select name="txpower" class="formselect" id="txpower">
2159
									<?
2160
									for($x = 99; $x > 0; $x--) {
2161
										if($pconfig["txpower"] == $x)
2162
											$SELECTED = " SELECTED";
2163
										else
2164
											$SELECTED = "";
2165
										echo "<option {$SELECTED}>{$x}</option>\n";
2166
									}
2167
									?>
2168
								</select><br/>
2169 3b7f0f53 Erik Fonnesbeck
								<?=gettext("Note: Typically only a few discreet power settings are available and the driver will use the setting closest to the specified value.  Not all adapters support changing the transmit power setting."); ?>
2170 9978e156 gnhb
							</td>
2171
						</tr>
2172
						<tr>
2173 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncellreq"><?=gettext("Channel"); ?></td>
2174 30ade846 gnhb
							<td class="vtable">
2175
								<select name="channel" class="formselect" id="channel">
2176 ee9933b6 Renato Botelho
									<option <?php if ($pconfig['channel'] == 0) echo "selected"; ?> value="0"><?=gettext("Auto"); ?></option>
2177 9978e156 gnhb
									<?php
2178 30ade846 gnhb
									foreach($wl_modes as $wl_standard => $wl_channels) {
2179
										if($wl_standard == "11g") { $wl_standard = "11b/g"; }
2180
										else if($wl_standard == "11ng") { $wl_standard = "11b/g/n"; }
2181
										else if($wl_standard == "11na") { $wl_standard = "11a/n"; }
2182
										foreach($wl_channels as $wl_channel) {
2183
											echo "<option ";
2184
											if ($pconfig['channel'] == "$wl_channel") {
2185
												echo "selected ";
2186
											}
2187
											echo "value=\"$wl_channel\">$wl_standard - $wl_channel";
2188
											if(isset($wl_chaninfo[$wl_channel]))
2189
												echo " ({$wl_chaninfo[$wl_channel][1]} @ {$wl_chaninfo[$wl_channel][2]} / {$wl_chaninfo[$wl_channel][3]})";
2190
											echo "</option>\n";
2191 d85ba87f gnhb
										}
2192 9978e156 gnhb
									}
2193
									?>
2194
								</select>
2195 30ade846 gnhb
								<br/>
2196 136c598d Carlos Eduardo Ramos
								<?=gettext("Legend: wireless standards - channel # (frequency @ max TX power / TX power allowed in reg. domain)"); ?>
2197 30ade846 gnhb
								<br/>
2198 933ea015 Carlos Eduardo Ramos
								<?=gettext("Note: Not all channels may be supported by your card.  Auto may override the wireless standard selected above."); ?>
2199 9978e156 gnhb
							</td>
2200
						</tr>
2201 537bf7b3 Erik Fonnesbeck
						<?php if (isset($wl_sysctl["{$wl_sysctl_prefix}.diversity"]) || isset($wl_sysctl["{$wl_sysctl_prefix}.txantenna"]) || isset($wl_sysctl["{$wl_sysctl_prefix}.rxantenna"])): ?>
2202
						<tr>
2203
							<td valign="top" class="vncell"><?=gettext("Antenna settings"); ?></td>
2204
							<td class="vtable">
2205
								<table border="0" cellpadding="0" cellspacing="0">
2206
									<tr>
2207
										<?php if (isset($wl_sysctl["{$wl_sysctl_prefix}.diversity"])): ?>
2208
										<td>
2209
											<?=gettext("Diversity"); ?><br/>
2210
											<select name="diversity" class="formselect" id="diversity">
2211 1930ccb6 Erik Fonnesbeck
												<option <?php if (!isset($pconfig['diversity'])) echo "selected"; ?> value=""><?=gettext("Default"); ?></option>
2212
												<option <?php if ($pconfig['diversity'] === '0') echo "selected"; ?> value="0"><?=gettext("Off"); ?></option>
2213
												<option <?php if ($pconfig['diversity'] === '1') echo "selected"; ?> value="1"><?=gettext("On"); ?></option>
2214 537bf7b3 Erik Fonnesbeck
											</select>
2215
										</td>
2216
										<td>&nbsp;&nbsp</td>
2217
										<?php endif; ?>
2218
										<?php if (isset($wl_sysctl["{$wl_sysctl_prefix}.txantenna"])): ?>
2219
										<td>
2220
											<?=gettext("Transmit antenna"); ?><br/>
2221
											<select name="txantenna" class="formselect" id="txantenna">
2222 1930ccb6 Erik Fonnesbeck
												<option <?php if (!isset($pconfig['txantenna'])) echo "selected"; ?> value=""><?=gettext("Default"); ?></option>
2223
												<option <?php if ($pconfig['txantenna'] === '0') echo "selected"; ?> value="0"><?=gettext("Auto"); ?></option>
2224
												<option <?php if ($pconfig['txantenna'] === '1') echo "selected"; ?> value="1"><?=gettext("#1"); ?></option>
2225
												<option <?php if ($pconfig['txantenna'] === '2') echo "selected"; ?> value="2"><?=gettext("#2"); ?></option>
2226 537bf7b3 Erik Fonnesbeck
											</select>
2227
										</td>
2228
										<td>&nbsp;&nbsp</td>
2229
										<?php endif; ?>
2230
										<?php if (isset($wl_sysctl["{$wl_sysctl_prefix}.rxantenna"])): ?>
2231
										<td>
2232
											<?=gettext("Receive antenna"); ?><br/>
2233
											<select name="rxantenna" class="formselect" id="rxantenna">
2234 1930ccb6 Erik Fonnesbeck
												<option <?php if (!isset($pconfig['rxantenna'])) echo "selected"; ?> value=""><?=gettext("Default"); ?></option>
2235
												<option <?php if ($pconfig['rxantenna'] === '0') echo "selected"; ?> value="0"><?=gettext("Auto"); ?></option>
2236
												<option <?php if ($pconfig['rxantenna'] === '1') echo "selected"; ?> value="1"><?=gettext("#1"); ?></option>
2237
												<option <?php if ($pconfig['rxantenna'] === '2') echo "selected"; ?> value="2"><?=gettext("#2"); ?></option>
2238 537bf7b3 Erik Fonnesbeck
											</select>
2239
										</td>
2240
										<?php endif; ?>
2241
									</tr>
2242
								</table>
2243
								<br/>
2244
								<?=gettext("Note: The antenna numbers do not always match up with the labels on the card."); ?>
2245
							</td>
2246
						</tr>
2247
						<?php endif; ?>
2248 6681fdd3 Erik Fonnesbeck
						<?php if (isset($wl_sysctl["{$wl_sysctl_prefix}.slottime"]) && isset($wl_sysctl["{$wl_sysctl_prefix}.acktimeout"]) && isset($wl_sysctl["{$wl_sysctl_prefix}.ctstimeout"])): ?>
2249 9978e156 gnhb
						<tr>
2250 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Distance setting"); ?></td>
2251 30ade846 gnhb
							<td class="vtable">
2252
								<input name="distance" type="text" class="formfld unknown" id="distance" size="5" value="<?=htmlspecialchars($pconfig['distance']);?>">
2253
								<br/>
2254 136c598d Carlos Eduardo Ramos
								<?=gettext("Note: This field can be used to tune ACK/CTS timers to fit the distance between AP and Client"); ?><br/>
2255
								<?=gettext("(measured in Meters and works only for Atheros based cards !)"); ?>
2256 30ade846 gnhb
							</td>
2257 9978e156 gnhb
						</tr>
2258 6681fdd3 Erik Fonnesbeck
						<?php endif; ?>
2259 9978e156 gnhb
						<tr>
2260 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Regulatory settings"); ?></td>
2261 30ade846 gnhb
							<td class="vtable">
2262 136c598d Carlos Eduardo Ramos
								<?=gettext("Regulatory domain"); ?><br/>
2263 30ade846 gnhb
								<select name="regdomain" class="formselect" id="regdomain">
2264 ee9933b6 Renato Botelho
									<option <?php if (empty($pconfig['regdomain'])) echo "selected"; ?> value=""><?=gettext("Default"); ?></option>
2265 30ade846 gnhb
									<?php
2266
									foreach($wl_regdomains as $wl_regdomain_key => $wl_regdomain) {
2267
										echo "<option ";
2268
										if ($pconfig['regdomain'] == $wl_regdomains_attr[$wl_regdomain_key]['ID']) {
2269
											echo "selected ";
2270
										}
2271
										echo "value=\"{$wl_regdomains_attr[$wl_regdomain_key]['ID']}\">{$wl_regdomain['name']}</option>\n";
2272
									}
2273
									?>
2274
								</select>
2275
								<br/>
2276 933ea015 Carlos Eduardo Ramos
								<?=gettext("Note: Some cards have a default that is not recognized and require changing the regulatory domain to one in this list for the changes to other regulatory settings to work."); ?>
2277 30ade846 gnhb
								<br/><br/>
2278 136c598d Carlos Eduardo Ramos
								<?=gettext("Country (listed with country code and regulatory domain)"); ?><br/>
2279 30ade846 gnhb
								<select name="regcountry" class="formselect" id="regcountry">
2280 ee9933b6 Renato Botelho
									<option <?php if (empty($pconfig['regcountry'])) echo "selected"; ?> value=""><?=gettext("Default"); ?></option>
2281 30ade846 gnhb
									<?php
2282
									foreach($wl_countries as $wl_country_key => $wl_country) {
2283
										echo "<option ";
2284
										if ($pconfig['regcountry'] == $wl_countries_attr[$wl_country_key]['ID']) {
2285
											echo "selected ";
2286
										}
2287
										echo "value=\"{$wl_countries_attr[$wl_country_key]['ID']}\">{$wl_country['name']} -- ({$wl_countries_attr[$wl_country_key]['ID']}, " . strtoupper($wl_countries_attr[$wl_country_key]['rd'][0]['REF']) . ")</option>\n";
2288
									}
2289
									?>
2290
								</select>
2291
								<br/>
2292 136c598d Carlos Eduardo Ramos
								<?=gettext("Note: Any country setting other than \"Default\" will override the regulatory domain setting"); ?>.
2293 30ade846 gnhb
								<br/><br/>
2294 136c598d Carlos Eduardo Ramos
								<?=gettext("Location"); ?><br/>
2295 30ade846 gnhb
								<select name="reglocation" class="formselect" id="reglocation">
2296 ee9933b6 Renato Botelho
									<option <?php if (empty($pconfig['reglocation'])) echo "selected"; ?> value=""><?=gettext("Default"); ?></option>
2297
									<option <?php if ($pconfig['reglocation'] == 'indoor') echo "selected"; ?> value="indoor"><?=gettext("Indoor"); ?></option>
2298
									<option <?php if ($pconfig['reglocation'] == 'outdoor') echo "selected"; ?> value="outdoor"><?=gettext("Outdoor"); ?></option>
2299
									<option <?php if ($pconfig['reglocation'] == 'anywhere') echo "selected"; ?> value="anywhere"><?=gettext("Anywhere"); ?></option>
2300 30ade846 gnhb
								</select>
2301
								<br/><br/>
2302 933ea015 Carlos Eduardo Ramos
								<?=gettext("These settings may affect which channels are available and the maximum transmit power allowed on those channels.  Using the correct settings to comply with local regulatory requirements is recommended."); ?>
2303 30ade846 gnhb
								<br/>
2304 933ea015 Carlos Eduardo Ramos
								<?=gettext("Note: All wireless networks on this interface will be temporarily brought down when changing regulatory settings.  Some of the regulatory domains or country codes may not be allowed by some cards.  These settings may not be able to add additional channels that are not already supported."); ?>
2305 9978e156 gnhb
							</td>
2306
						</tr>
2307
						<tr>
2308 30ade846 gnhb
							<td colspan="2" valign="top" height="16"></td>
2309 c0948c6c Renato Botelho
						</tr>
2310 30ade846 gnhb
						<tr>
2311 4256d115 Renato Botelho
							<td colspan="2" valign="top" class="listtopic"><?=gettext("Network-specific wireless configuration");?></td>
2312 30ade846 gnhb
						</tr>
2313
						<tr>
2314 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncellreq"><?=gettext("Mode"); ?></td>
2315 30ade846 gnhb
							<td class="vtable">
2316
								<select name="mode" class="formselect" id="mode">
2317 ee9933b6 Renato Botelho
									<option <?php if ($pconfig['mode'] == 'bss') echo "selected";?> value="bss"><?=gettext("Infrastructure (BSS)"); ?></option>
2318
									<option <?php if ($pconfig['mode'] == 'adhoc') echo "selected";?> value="adhoc"><?=gettext("Ad-hoc (IBSS)"); ?></option>
2319
									<option <?php if ($pconfig['mode'] == 'hostap') echo "selected";?> value="hostap"><?=gettext("Access Point"); ?></option>
2320 30ade846 gnhb
								</select>
2321 9978e156 gnhb
							</td>
2322
						</tr>
2323
						<tr>
2324 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncellreq"><?=gettext("SSID"); ?></td>
2325 30ade846 gnhb
							<td class="vtable">
2326
								<input name="ssid" type="text" class="formfld unknown" id="ssid" size="20" value="<?=htmlspecialchars($pconfig['ssid']); ?>">
2327 cb3c3fe4 Namezero
								<br/>
2328
								<?=gettext("Note: Only required in Access Point mode. If left blank in Ad-hoc or Infrastructure mode, this interface will connect to any available SSID"); ?>
2329 9978e156 gnhb
							</td>
2330
						</tr>
2331 30ade846 gnhb
						<?php if (isset($wl_modes['11ng']) || isset($wl_modes['11na'])): ?>
2332 9978e156 gnhb
						<tr>
2333 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Minimum wireless standard"); ?></td>
2334 30ade846 gnhb
							<td class="vtable">
2335
								<select name="puremode" class="formselect" id="puremode">
2336 ee9933b6 Renato Botelho
									<option <?php if ($pconfig['puremode'] == 'any') echo "selected";?> value="any"><?=gettext("Any"); ?></option>
2337 30ade846 gnhb
									<?php if (isset($wl_modes['11g'])): ?>
2338 ee9933b6 Renato Botelho
									<option <?php if ($pconfig['puremode'] == '11g') echo "selected";?> value="11g"><?=gettext("802.11g"); ?></option>
2339 30ade846 gnhb
									<?php endif; ?>
2340 ee9933b6 Renato Botelho
									<option <?php if ($pconfig['puremode'] == '11n') echo "selected";?> value="11n"><?=gettext("802.11n"); ?></option>
2341 30ade846 gnhb
								</select>
2342
								<br/>
2343 933ea015 Carlos Eduardo Ramos
								<?=gettext("When operating as an access point, allow only stations capable of the selected wireless standard to associate (stations not capable are not permitted to associate)."); ?>
2344 9978e156 gnhb
							</td>
2345
						</tr>
2346 30ade846 gnhb
						<?php elseif (isset($wl_modes['11g'])): ?>
2347 9978e156 gnhb
						<tr>
2348 933ea015 Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("802.11g only"); ?></td>
2349 30ade846 gnhb
							<td class="vtable">
2350 ee9933b6 Renato Botelho
								<input name="puremode" type="checkbox" value="11g"  class="formfld" id="puremode" <?php if ($pconfig['puremode'] == '11g') echo "checked";?>>
2351 933ea015 Carlos Eduardo Ramos
								<br/><?=gettext("When operating as an access point in 802.11g mode, allow only 11g-capable stations to associate (11b-only stations are not permitted to associate)."); ?>
2352 9978e156 gnhb
							</td>
2353
						</tr>
2354 30ade846 gnhb
						<?php endif; ?>
2355 9978e156 gnhb
						<tr>
2356 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Allow intra-BSS communication"); ?></td>
2357 30ade846 gnhb
							<td class="vtable">
2358 ee9933b6 Renato Botelho
								<input name="apbridge_enable" type="checkbox" value="yes"  class="formfld" id="apbridge_enable" <?php if ($pconfig['apbridge_enable']) echo "checked";?>>
2359 30ade846 gnhb
								<br/>
2360 933ea015 Carlos Eduardo Ramos
								<?=gettext("When operating as an access point, enable this if you want to pass packets between wireless clients directly."); ?>
2361 30ade846 gnhb
								<br/>
2362 933ea015 Carlos Eduardo Ramos
								<?=gettext("Disabling the internal bridging is useful when traffic is to be processed with packet filtering."); ?>
2363 30ade846 gnhb
							</td>
2364
						</tr>
2365
						<tr>
2366 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Enable WME"); ?></td>
2367 30ade846 gnhb
							<td class="vtable">
2368 ee9933b6 Renato Botelho
								<input name="wme_enable" type="checkbox" class="formfld" id="wme_enable" value="yes" <?php if ($pconfig['wme_enable']) echo "checked";?>>
2369 933ea015 Carlos Eduardo Ramos
								<br/><?=gettext("Setting this option will force the card to use WME (wireless QoS)."); ?>
2370 30ade846 gnhb
							</td>
2371
						</tr>
2372
						<tr>
2373 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Enable Hide SSID"); ?></td>
2374 30ade846 gnhb
							<td class="vtable">
2375 ee9933b6 Renato Botelho
								<input name="hidessid_enable" type="checkbox" class="formfld" id="hidessid_enable" value="yes" <?php if ($pconfig['hidessid_enable']) echo "checked";?>>
2376 30ade846 gnhb
								<br/>
2377 136c598d Carlos Eduardo Ramos
								<?=gettext("Setting this option will force the card to NOT broadcast its SSID"); ?>
2378 30ade846 gnhb
								<br/>
2379 933ea015 Carlos Eduardo Ramos
								<?=gettext("(this might create problems for some clients)."); ?>
2380 30ade846 gnhb
							</td>
2381
						</tr>
2382
						<tr>
2383 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("WEP"); ?></td>
2384 c0948c6c Renato Botelho
							<td class="vtable">
2385 ee9933b6 Renato Botelho
								<input name="wep_enable" type="checkbox" id="wep_enable" value="yes" <?php if ($pconfig['wep_enable']) echo "checked"; ?>>
2386 136c598d Carlos Eduardo Ramos
								<strong><?=gettext("Enable WEP"); ?></strong>
2387 30ade846 gnhb
								<table border="0" cellspacing="0" cellpadding="0">
2388 9978e156 gnhb
									<tr>
2389 30ade846 gnhb
										<td>&nbsp;</td>
2390
										<td>&nbsp;</td>
2391 136c598d Carlos Eduardo Ramos
										<td>&nbsp;<?=gettext("TX key"); ?>&nbsp;</td>
2392 30ade846 gnhb
									</tr>
2393
									<tr>
2394 933ea015 Carlos Eduardo Ramos
										<td><?=gettext("Key 1:"); ?>&nbsp;&nbsp;</td>
2395 30ade846 gnhb
										<td>
2396
											<input name="key1" type="text" class="formfld unknown" id="key1" size="30" value="<?=htmlspecialchars($pconfig['key1']);?>">
2397
										</td>
2398
										<td align="center">
2399 ee9933b6 Renato Botelho
											<input name="txkey" type="radio" value="1" <?php if ($pconfig['txkey'] == 1) echo "checked";?>>
2400 30ade846 gnhb
										</td>
2401
									</tr>
2402
									<tr>
2403 933ea015 Carlos Eduardo Ramos
										<td><?=gettext("Key 2:"); ?>&nbsp;&nbsp;</td>
2404 30ade846 gnhb
										<td>
2405
											<input name="key2" type="text" class="formfld unknown" id="key2" size="30" value="<?=htmlspecialchars($pconfig['key2']);?>">
2406
										</td>
2407
										<td align="center">
2408 ee9933b6 Renato Botelho
											<input name="txkey" type="radio" value="2" <?php if ($pconfig['txkey'] == 2) echo "checked";?>>
2409 30ade846 gnhb
										</td>
2410
									</tr>
2411
									<tr>
2412 933ea015 Carlos Eduardo Ramos
										<td><?=gettext("Key 3:"); ?>&nbsp;&nbsp;</td>
2413 30ade846 gnhb
										<td>
2414
											<input name="key3" type="text" class="formfld unknown" id="key3" size="30" value="<?=htmlspecialchars($pconfig['key3']);?>">
2415
										</td>
2416
										<td align="center">
2417 ee9933b6 Renato Botelho
											<input name="txkey" type="radio" value="3" <?php if ($pconfig['txkey'] == 3) echo "checked";?>>
2418 30ade846 gnhb
										</td>
2419
									</tr>
2420
									<tr>
2421 933ea015 Carlos Eduardo Ramos
										<td><?=gettext("Key 4:"); ?>&nbsp;&nbsp;</td>
2422 30ade846 gnhb
										<td>
2423
											<input name="key4" type="text" class="formfld unknown" id="key4" size="30" value="<?=htmlspecialchars($pconfig['key4']);?>">
2424
										</td>
2425
										<td align="center">
2426 ee9933b6 Renato Botelho
											<input name="txkey" type="radio" value="4" <?php if ($pconfig['txkey'] == 4) echo "checked";?>>
2427 9978e156 gnhb
										</td>
2428
									</tr>
2429
								</table>
2430 30ade846 gnhb
								<br/>
2431 933ea015 Carlos Eduardo Ramos
								<?=gettext("40 (64) bit keys may be entered as 5 ASCII characters or 10 hex digits preceded by '0x'."); ?><br/>
2432
								<?=gettext("104 (128) bit keys may be entered as 13 ASCII characters or 26 hex digits preceded by '0x'."); ?>
2433 9978e156 gnhb
							</td>
2434
						</tr>
2435
						<tr>
2436 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("WPA"); ?></td>
2437 30ade846 gnhb
							<td class="vtable">
2438 ee9933b6 Renato Botelho
								<input name="wpa_enable" type="checkbox" class="formfld" id="wpa_enable" value="yes" <?php if ($pconfig['wpa_enable']) echo "checked"; ?>>
2439 136c598d Carlos Eduardo Ramos
								<strong><?=gettext("Enable WPA"); ?></strong>
2440 30ade846 gnhb
								<br/><br/>
2441
								<table border="0" cellspacing="0" cellpadding="0">
2442
									<tr>
2443
										<td>&nbsp;</td>
2444 2a2b247b jim-p
										<td>&nbsp;<?=gettext("WPA Pre-Shared Key"); ?>&nbsp;</td>
2445 30ade846 gnhb
									</tr>
2446
									<tr>
2447 933ea015 Carlos Eduardo Ramos
										<td><?=gettext("PSK:"); ?>&nbsp;&nbsp;</td>
2448 30ade846 gnhb
										<td>
2449
											<input name="passphrase" type="text" class="formfld unknown" id="passphrase" size="66" value="<?=htmlspecialchars($pconfig['passphrase']);?>">
2450
										</td>
2451
									</tr>
2452
								</table>
2453 933ea015 Carlos Eduardo Ramos
								<br/><?=gettext("Passphrase must be from 8 to 63 characters."); ?>
2454 30ade846 gnhb
							</td>
2455 9978e156 gnhb
						</tr>
2456
						<tr>
2457 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("WPA Mode"); ?></td>
2458 30ade846 gnhb
							<td class="vtable">
2459
								<select name="wpa_mode" class="formselect" id="wpa_mode">
2460 ee9933b6 Renato Botelho
									<option <?php if ($pconfig['wpa_mode'] == '1') echo "selected";?> value="1"><?=gettext("WPA"); ?></option>
2461
									<option <?php if ($pconfig['wpa_mode'] == '2') echo "selected";?> value="2"><?=gettext("WPA2"); ?></option>
2462
									<option <?php if ($pconfig['wpa_mode'] == '3') echo "selected";?> value="3"><?=gettext("Both"); ?></option>
2463 30ade846 gnhb
								</select>
2464 9978e156 gnhb
							</td>
2465
						</tr>
2466
						<tr>
2467 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("WPA Key Management Mode"); ?></td>
2468 c0948c6c Renato Botelho
							<td class="vtable">
2469 30ade846 gnhb
								<select name="wpa_key_mgmt" class="formselect" id="wpa_key_mgmt">
2470 2a2b247b jim-p
									<option <?php if ($pconfig['wpa_key_mgmt'] == 'WPA-PSK') echo "selected";?> value="WPA-PSK"><?=gettext("Pre-Shared Key"); ?></option>
2471 ee9933b6 Renato Botelho
									<option <?php if ($pconfig['wpa_key_mgmt'] == 'WPA-EAP') echo "selected";?> value="WPA-EAP"><?=gettext("Extensible Authentication Protocol"); ?></option>
2472
									<option <?php if ($pconfig['wpa_key_mgmt'] == 'WPA-PSK WPA-EAP') echo "selected";?> value="WPA-PSK WPA-EAP"><?=gettext("Both"); ?></option>
2473 30ade846 gnhb
								</select>
2474 9978e156 gnhb
							</td>
2475
						</tr>
2476
						<tr>
2477 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Authentication"); ?></td>
2478 30ade846 gnhb
							<td class="vtable">
2479
								<select name="auth_algs" class="formselect" id="auth_algs">
2480 ee9933b6 Renato Botelho
									<option <?php if ($pconfig['auth_algs'] == '1') echo "selected";?> value="1"><?=gettext("Open System Authentication"); ?></option>
2481
									<option <?php if ($pconfig['auth_algs'] == '2') echo "selected";?> value="2"><?=gettext("Shared Key Authentication"); ?></option>
2482
									<option <?php if ($pconfig['auth_algs'] == '3') echo "selected";?> value="3"><?=gettext("Both"); ?></option>
2483 9978e156 gnhb
								</select>
2484 933ea015 Carlos Eduardo Ramos
								<br/><?=gettext("Note: Shared Key Authentication requires WEP."); ?></br>
2485 9978e156 gnhb
							</td>
2486
						</tr>
2487
						<tr>
2488 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("WPA Pairwise"); ?></td>
2489 30ade846 gnhb
							<td class="vtable">
2490
								<select name="wpa_pairwise" class="formselect" id="wpa_pairwise">
2491 ee9933b6 Renato Botelho
									<option <?php if ($pconfig['wpa_pairwise'] == 'CCMP TKIP') echo "selected";?> value="CCMP TKIP"><?=gettext("Both"); ?></option>
2492
									<option <?php if ($pconfig['wpa_pairwise'] == 'CCMP') echo "selected";?> value="CCMP"><?=gettext("AES (recommended)"); ?></option>
2493
									<option <?php if ($pconfig['wpa_pairwise'] == 'TKIP') echo "selected";?> value="TKIP"><?=gettext("TKIP"); ?></option>
2494 30ade846 gnhb
								</select>
2495 9978e156 gnhb
							</td>
2496
						</tr>
2497
						<tr>
2498 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Key Rotation"); ?></td>
2499 30ade846 gnhb
							<td class="vtable">
2500 ee9933b6 Renato Botelho
								<input name="wpa_group_rekey" type="text" class="formfld unknown" id="wpa_group_rekey" size="30" value="<?php echo $pconfig['wpa_group_rekey'] ? $pconfig['wpa_group_rekey'] : "60";?>">
2501 933ea015 Carlos Eduardo Ramos
								<br/><?=gettext("Allowed values are 1-9999 but should not be longer than Master Key Regeneration time."); ?>
2502 9978e156 gnhb
							</td>
2503
						</tr>
2504
						<tr>
2505 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Master Key Regeneration"); ?></td>
2506 30ade846 gnhb
							<td class="vtable">
2507 ee9933b6 Renato Botelho
								<input name="wpa_gmk_rekey" type="text" class="formfld" id="wpa_gmk_rekey" size="30" value="<?php echo $pconfig['wpa_gmk_rekey'] ? $pconfig['wpa_gmk_rekey'] : "3600";?>">
2508 933ea015 Carlos Eduardo Ramos
								<br/><?=gettext("Allowed values are 1-9999 but should not be shorter than Key Rotation time."); ?>
2509 9978e156 gnhb
							</td>
2510
						</tr>
2511
						<tr>
2512 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Strict Key Regeneration"); ?></td>
2513 30ade846 gnhb
							<td class="vtable">
2514 ee9933b6 Renato Botelho
								<input name="wpa_strict_rekey" type="checkbox" value="yes"  class="formfld" id="wpa_strict_rekey" <?php if ($pconfig['wpa_strict_rekey']) echo "checked"; ?>>
2515 933ea015 Carlos Eduardo Ramos
								<br/><?=gettext("Setting this option will force the AP to rekey whenever a client disassociates."); ?>
2516 30ade846 gnhb
							</td>
2517 9978e156 gnhb
						</tr>
2518
						<tr>
2519 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Enable IEEE802.1X Authentication"); ?></td>
2520 30ade846 gnhb
							<td class="vtable">
2521 ee9933b6 Renato Botelho
								<input name="ieee8021x" type="checkbox" value="yes"  class="formfld" id="ieee8021x" <?php if ($pconfig['ieee8021x']) echo "checked";?>>
2522 933ea015 Carlos Eduardo Ramos
								<br/><?=gettext("Setting this option will enable 802.1x authentication."); ?>
2523 10e4d55e Pierre POMES
								<br/><span class="red"><strong><?=gettext("NOTE"); ?>:</strong></span> <?=gettext("this option requires checking the \"Enable WPA box\"."); ?>
2524 9978e156 gnhb
							</td>
2525
						</tr>
2526
						<tr>
2527 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("802.1X Authentication Server IP Address"); ?></td>
2528 30ade846 gnhb
							<td class="vtable">
2529
								<input name="auth_server_addr" id="auth_server_addr" type="text" class="formfld unknown" size="66" value="<?=htmlspecialchars($pconfig['auth_server_addr']);?>">
2530 136c598d Carlos Eduardo Ramos
								<br/><?=gettext("Enter the IP address of the 802.1X Authentication Server.  This is commonly a Radius server (FreeRadius, Internet Authentication Services, etc.)"); ?>
2531 9978e156 gnhb
							</td>
2532
						</tr>
2533
						<tr>
2534 933ea015 Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("802.1X Authentication Server Port"); ?></td>
2535 30ade846 gnhb
							<td class="vtable">
2536
								<input name="auth_server_port" id="auth_server_port" type="text" class="formfld unknown" size="66" value="<?=htmlspecialchars($pconfig['auth_server_port']);?>">
2537 933ea015 Carlos Eduardo Ramos
								<br/><?=gettext("Leave blank for the default 1812 port."); ?>
2538 9978e156 gnhb
							</td>
2539
						</tr>
2540
						<tr>
2541 933ea015 Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("802.1X Authentication Server Shared Secret"); ?></td>
2542 30ade846 gnhb
							<td class="vtable">
2543
								<input name="auth_server_shared_secret" id="auth_server_shared_secret" type="text" class="formfld unknown" size="66" value="<?=htmlspecialchars($pconfig['auth_server_shared_secret']);?>">
2544
								<br/>
2545 9978e156 gnhb
							</td>
2546 30ade846 gnhb
						</tr>
2547 32764288 Namezero
						<tr>
2548
					<td valign="top" class="vncell"><?=gettext("Secondary 802.1X Authentication Server IP Address"); ?></td>
2549
							<td class="vtable">
2550
								<input name="auth_server_addr2" id="auth_server_addr2" type="text" class="formfld unknown" size="66" value="<?=htmlspecialchars($pconfig['auth_server_addr2']);?>">
2551
								<br/><?=gettext("Enter the IP address of the 802.1X Authentication Server.  This is commonly a Radius server (FreeRadius, Internet Authentication Services, etc.)"); ?>
2552
							</td>
2553
						</tr>
2554
						<tr>
2555
							<td valign="top" class="vncell"><?=gettext("Secondary 802.1X Authentication Server Port"); ?></td>
2556
							<td class="vtable">
2557
								<input name="auth_server_port2" id="auth_server_port2" type="text" class="formfld unknown" size="66" value="<?=htmlspecialchars($pconfig['auth_server_port2']);?>">
2558
								<br/><?=gettext("Leave blank for the default 1812 port."); ?>
2559
							</td>
2560
						</tr>
2561
						<tr>
2562
							<td valign="top" class="vncell"><?=gettext("Secondary 802.1X Authentication Server Shared Secret"); ?></td>
2563
							<td class="vtable">
2564
								<input name="auth_server_shared_secret2" id="auth_server_shared_secret2" type="text" class="formfld unknown" size="66" value="<?=htmlspecialchars($pconfig['auth_server_shared_secret2']);?>">
2565
								<br/>
2566
							</td>
2567
						</tr>
2568 c9e7d30d Scott Ullrich
						<tr>
2569
							<td valign="top" class="vncell">802.1X <?=gettext("Authentication Roaming Preauth"); ?></td>
2570
							<td class="vtable">
2571 a3381369 Colin Fleming
								<input name="rsn_preauth" id="rsn_preauth" type="checkbox" class="formfld unknown" size="66" value="yes" <?php if ($pconfig['rsn_preauth']) echo "checked"; ?>>
2572 c9e7d30d Scott Ullrich
								<br/>
2573
							</td>
2574
						</tr>
2575 ee9933b6 Renato Botelho
						<?php endif; ?>
2576 30ade846 gnhb
						<tr>
2577
							<td colspan="2" valign="top" height="16"></td>
2578
						</tr>
2579
						<tr>
2580 136c598d Carlos Eduardo Ramos
							<td colspan="2" valign="top" class="listtopic"><?=gettext("Private networks"); ?></td>
2581 30ade846 gnhb
						</tr>
2582
						<tr>
2583
							<td valign="middle" class="vncell">&nbsp;</td>
2584
							<td class="vtable">
2585 c0948c6c Renato Botelho
								<a name="rfc1918"></a>
2586 30ade846 gnhb
								<input name="blockpriv" type="checkbox" id="blockpriv" value="yes" <?php if ($pconfig['blockpriv']) echo "checked"; ?>>
2587 136c598d Carlos Eduardo Ramos
								<strong><?=gettext("Block private networks"); ?></strong><br>
2588
								<?=gettext("When set, this option blocks traffic from IP addresses that are reserved " .
2589
								"for private  networks as per RFC 1918 (10/8, 172.16/12, 192.168/16) as"); ?>
2590 933ea015 Carlos Eduardo Ramos
								<?=gettext("well as loopback addresses (127/8)."); ?>&nbsp;&nbsp; <?=gettext("You should generally " .
2591 136c598d Carlos Eduardo Ramos
								"leave this option turned on, unless your WAN network lies in such " .
2592 c0948c6c Renato Botelho
								"a private address space, too."); ?>
2593 9978e156 gnhb
							</td>
2594
						</tr>
2595
						<tr>
2596 30ade846 gnhb
							<td valign="middle" class="vncell">&nbsp;</td>
2597 c0948c6c Renato Botelho
							<td class="vtable">
2598 30ade846 gnhb
								<input name="blockbogons" type="checkbox" id="blockbogons" value="yes" <?php if ($pconfig['blockbogons']) echo "checked"; ?>>
2599 136c598d Carlos Eduardo Ramos
								<strong><?=gettext("Block bogon networks"); ?></strong><br>
2600
								<?=gettext("When set, this option blocks traffic from IP addresses that are reserved " .
2601 933ea015 Carlos Eduardo Ramos
								"(but not RFC 1918) or not yet assigned by IANA."); ?>&nbsp;&nbsp;
2602 136c598d Carlos Eduardo Ramos
								<?=gettext("Bogons are prefixes that should never appear in the Internet routing table, " .
2603 933ea015 Carlos Eduardo Ramos
								"and obviously should not appear as the source address in any packets you receive."); ?>
2604 6b4480dc bcyrill
								<br/><br/>
2605
								<?=gettext("Note: The update frequency can be changed under System->Advanced Firewall/NAT settings.")?>
2606 30ade846 gnhb
							</td>
2607 9978e156 gnhb
						</tr>
2608 1600b1af Scott Ullrich
					</table> <!-- End "allcfg" table -->
2609
					</div> <!-- End "allcfg" div -->
2610
2611
					<table width="100%" border="0" cellpadding="6" cellspacing="0">
2612 9978e156 gnhb
						<tr>
2613 7b8db0c3 Erik Fonnesbeck
							<td width="22%" valign="top">
2614 30ade846 gnhb
								&nbsp;
2615
							</td>
2616 7b8db0c3 Erik Fonnesbeck
							<td width="78%">
2617 30ade846 gnhb
								<br/>
2618 c0948c6c Renato Botelho
								<input id="save" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>">
2619 136c598d Carlos Eduardo Ramos
								<input id="cancel" type="button" class="formbtn" value="<?=gettext("Cancel"); ?>" onclick="history.back()">
2620 30ade846 gnhb
								<input name="if" type="hidden" id="if" value="<?=$if;?>">
2621 1d7e1d6c gnhb
								<?php if ($wancfg['if'] == $a_ppps[$pppid]['if']) : ?>
2622 dd5bf424 Scott Ullrich
								<input name="ppp_port" type="hidden" value="<?=htmlspecialchars($pconfig['port']);?>">
2623 30ade846 gnhb
								<?php endif; ?>
2624 dd5bf424 Scott Ullrich
								<input name="ptpid" type="hidden" value="<?=htmlspecialchars($pconfig['ptpid']);?>">
2625 9978e156 gnhb
							</td>
2626
						</tr>
2627 1600b1af Scott Ullrich
					</table>
2628 9978e156 gnhb
				</td>
2629
			</tr>
2630
		</table>
2631 30ade846 gnhb
		<!--
2632 9978e156 gnhb
		</div>
2633
		</td></tr>
2634
		</table>
2635 30ade846 gnhb
		-->
2636 9978e156 gnhb
	</form>
2637 30ade846 gnhb
	<script type="text/javascript">
2638
		var gatewayip;
2639
		var name;
2640 cfd40454 Seth Mos
		var gatewayipv6;
2641
		var namev6;
2642 30ade846 gnhb
		function show_add_gateway() {
2643
			document.getElementById("addgateway").style.display = '';
2644
			document.getElementById("addgwbox").style.display = 'none';
2645
			document.getElementById("gateway").style.display = 'none';
2646
			document.getElementById("save").style.display = 'none';
2647
			document.getElementById("cancel").style.display = 'none';
2648
			document.getElementById("gwsave").style.display = '';
2649
			document.getElementById("gwcancel").style.display = '';
2650 076b14b2 Vinicius Coque
			jQuery('#notebox').html("");
2651 30ade846 gnhb
		}
2652 cfd40454 Seth Mos
		function show_add_gateway_v6() {
2653
			document.getElementById("addgatewayv6").style.display = '';
2654
			document.getElementById("addgwboxv6").style.display = 'none';
2655
			document.getElementById("gatewayv6").style.display = 'none';
2656
			document.getElementById("save").style.display = 'none';
2657
			document.getElementById("cancel").style.display = 'none';
2658
			document.getElementById("gwsave").style.display = '';
2659
			document.getElementById("gwcancel").style.display = '';
2660 076b14b2 Vinicius Coque
			jQuery('#noteboxv6').html("");
2661 cfd40454 Seth Mos
		}
2662 30ade846 gnhb
		function hide_add_gateway() {
2663
			document.getElementById("addgateway").style.display = 'none';
2664 c0948c6c Renato Botelho
			document.getElementById("addgwbox").style.display = '';
2665 30ade846 gnhb
			document.getElementById("gateway").style.display = '';
2666
			document.getElementById("save").style.display = '';
2667
			document.getElementById("cancel").style.display = '';
2668
			document.getElementById("gwsave").style.display = '';
2669
			document.getElementById("gwcancel").style.display = '';
2670
		}
2671 cfd40454 Seth Mos
		function hide_add_gateway_v6() {
2672
			document.getElementById("addgatewayv6").style.display = 'none';
2673
			document.getElementById("addgwboxv6").style.display = '';
2674
			document.getElementById("gatewayv6").style.display = '';
2675
			document.getElementById("save").style.display = '';
2676
			document.getElementById("cancel").style.display = '';
2677
			document.getElementById("gwsave").style.display = '';
2678
			document.getElementById("gwcancel").style.display = '';
2679
		}
2680 30ade846 gnhb
		function hide_add_gatewaysave() {
2681
			document.getElementById("addgateway").style.display = 'none';
2682 076b14b2 Vinicius Coque
			jQuery('#status').html('<img src="/themes/metallic/images/misc/loader.gif"> One moment please...');
2683
			var iface = jQuery('#if').val();
2684
			name = jQuery('#name').val();
2685
			var descr = jQuery('#gatewaydescr').val();
2686
			gatewayip = jQuery('#gatewayip').val();
2687 32764288 Namezero
2688 076b14b2 Vinicius Coque
			var defaultgw = jQuery('#defaultgw').val();
2689 30ade846 gnhb
			var url = "system_gateways_edit.php";
2690 cfd40454 Seth Mos
			var pars = 'isAjax=true&defaultgw=' + escape(defaultgw) + '&interface=' + escape(iface) + '&name=' + escape(name) + '&descr=' + escape(descr) + '&gateway=' + escape(gatewayip);
2691 076b14b2 Vinicius Coque
			jQuery.ajax(
2692 30ade846 gnhb
				url,
2693
				{
2694 076b14b2 Vinicius Coque
					type: 'post',
2695
					data: pars,
2696
					error: report_failure,
2697
					complete: save_callback
2698 c0948c6c Renato Botelho
				});
2699 30ade846 gnhb
		}
2700 cfd40454 Seth Mos
		function hide_add_gatewaysave_v6() {
2701
			document.getElementById("addgatewayv6").style.display = 'none';
2702 076b14b2 Vinicius Coque
			jQuery('#statusv6').html('<img src="/themes/metallic/images/misc/loader.gif"> One moment please...');
2703
			var iface = jQuery('#if').val();
2704
			name = jQuery('#namev6').val();
2705
			var descr = jQuery('#gatewaydescrv6').val();
2706
			gatewayip = jQuery('#gatewayipv6').val();
2707
			var defaultgw = jQuery('#defaultgwv6').val();
2708 cfd40454 Seth Mos
			var url_v6 = "system_gateways_edit.php";
2709
			var pars_v6 = 'isAjax=true&defaultgw=' + escape(defaultgw) + '&interface=' + escape(iface) + '&name=' + escape(name) + '&descr=' + escape(descr) + '&gateway=' + escape(gatewayip);
2710 076b14b2 Vinicius Coque
			jQuery.ajax(
2711 cfd40454 Seth Mos
				url_v6,
2712
				{
2713 076b14b2 Vinicius Coque
					type: 'post',
2714
					data: pars_v6,
2715
					error: report_failure_v6,
2716
					complete: save_callback_v6
2717 cfd40454 Seth Mos
				});
2718
		}
2719 30ade846 gnhb
		function addOption(selectbox,text,value)
2720
		{
2721
			var optn = document.createElement("OPTION");
2722
			optn.text = text;
2723
			optn.value = value;
2724 076b14b2 Vinicius Coque
			selectbox.append(optn);
2725
			selectbox.prop('selectedIndex',selectbox.children().length-1);
2726
			jQuery('#notebox').html("<p/><strong><?=gettext("NOTE:"); ?></strong> <?=gettext("You can manage Gateways"); ?> <a target='_new' href='system_gateways.php'><?=gettext("here"); ?></a>.");
2727 c0948c6c Renato Botelho
		}
2728 cfd40454 Seth Mos
		function addOption_v6(selectbox,text,value)
2729
		{
2730
			var optn = document.createElement("OPTION");
2731
			optn.text = text;
2732
			optn.value = value;
2733 076b14b2 Vinicius Coque
			selectbox.append(optn);
2734
			selectbox.prop('selectedIndex',selectbox.children().length-1);
2735
			jQuery('#noteboxv6').html("<p/><strong><?=gettext("NOTE:"); ?></strong> <?=gettext("You can manage Gateways"); ?> <a target='_new' href='system_gateways.php'><?=gettext("here"); ?></a>.");
2736 cfd40454 Seth Mos
		}
2737 a0edece9 Darren Embry
		function report_failure(request, textStatus, errorThrown) {
2738
			if (textStatus === "error" && request.getResponseHeader("Content-Type") === "text/plain") {
2739
				alert(request.responseText);
2740
			} else {
2741
				alert("Sorry, we could not create your IPv4 gateway at this time.");
2742
			}
2743 30ade846 gnhb
			hide_add_gateway();
2744
		}
2745 a0edece9 Darren Embry
		function report_failure_v6(request, textStatus, errorThrown) {
2746
			if (textStatus === "error" && request.getResponseHeader("Content-Type") === "text/plain") {
2747
				alert(request.responseText);
2748
			} else {
2749
				alert("Sorry, we could not create your IPv6 gateway at this time.");
2750
			}
2751 cfd40454 Seth Mos
			hide_add_gateway_v6();
2752
		}
2753 30ade846 gnhb
		function save_callback(transport) {
2754
			var response = transport.responseText;
2755
			if(response) {
2756
				document.getElementById("addgateway").style.display = 'none';
2757
				hide_add_gateway();
2758 076b14b2 Vinicius Coque
				jQuery('#status').html('');
2759 cfd40454 Seth Mos
				var gwtext = escape(name) + " - " + gatewayip;
2760 076b14b2 Vinicius Coque
				addOption(jQuery('#gateway'), gwtext, name);
2761 30ade846 gnhb
				// Auto submit form?
2762
				//document.iform.submit();
2763 ea1cea05 Vinicius Coque
				//jQuery('#status').html('<img src="/themes/metallic/images/misc/loader.gif">');
2764 30ade846 gnhb
			} else {
2765
				report_failure();
2766
			}
2767
		}
2768 6e2a15e6 Evgeny Yurchenko
		function show_advanced_media() {
2769
			document.getElementById("showadvmediabox").innerHTML='';
2770
			aodiv = document.getElementById('showmediaadv');
2771
			aodiv.style.display = "block";
2772
		}
2773 cfd40454 Seth Mos
		function save_callback_v6(transport) {
2774
			var response_v6 = transport.responseText;
2775
			if(response_v6) {
2776
				document.getElementById("addgatewayv6").style.display = 'none';
2777
				hide_add_gateway_v6();
2778 076b14b2 Vinicius Coque
				jQuery('#statusv6').html('');
2779 cfd40454 Seth Mos
				var gwtext_v6 = escape(name) + " - " + gatewayip;
2780 076b14b2 Vinicius Coque
				addOption_v6(jQuery('#gatewayv6'), gwtext_v6, name);
2781 cfd40454 Seth Mos
				// Auto submit form?
2782
				//document.iform.submit();
2783 ea1cea05 Vinicius Coque
				//jQuery('#statusv6').html('<img src="/themes/metallic/images/misc/loader.gif">');
2784 cfd40454 Seth Mos
			} else {
2785
				report_failure_v6();
2786
			}
2787
		}
2788 30ade846 gnhb
		<?php
2789 8672329c Erik Fonnesbeck
		echo "show_allcfg(document.iform.enable);";
2790 30ade846 gnhb
		echo "updateType('{$pconfig['type']}');\n";
2791 e029943a Seth Mos
		echo "updateTypeSix('{$pconfig['type6']}');\n";
2792 6c05cfb0 gnhb
		?>
2793 30ade846 gnhb
	</script>
2794
	<?php include("fend.inc"); ?>
2795
	</body>
2796 b09a92b7 Ermal Luçi
</html>