Project

General

Profile

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