Project

General

Profile

Download (180 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 ce77a9c4 Phil Davis
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
6 78fcfb9c Scott Ullrich
	Copyright (C) 2004-2008 Scott Ullrich
7 744ea190 Scott Ullrich
	Copyright (C) 2006 Daniel S. Haischt.
8 63c704c3 N0YB
	Copyright (C) 2008-2010 Ermal Luçi
9 c3b3cd36 Scott Ullrich
	All rights reserved.
10 b1c525ee Scott Ullrich
11 c3b3cd36 Scott Ullrich
	originally part of m0n0wall (http://m0n0.ch/wall)
12 5b237745 Scott Ullrich
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
13
	All rights reserved.
14 e2cd32df Scott Ullrich
15 5b237745 Scott Ullrich
	Redistribution and use in source and binary forms, with or without
16
	modification, are permitted provided that the following conditions are met:
17 e2cd32df Scott Ullrich
18 5b237745 Scott Ullrich
	1. Redistributions of source code must retain the above copyright notice,
19
	   this list of conditions and the following disclaimer.
20 e2cd32df Scott Ullrich
21 5b237745 Scott Ullrich
	2. Redistributions in binary form must reproduce the above copyright
22
	   notice, this list of conditions and the following disclaimer in the
23
	   documentation and/or other materials provided with the distribution.
24 e2cd32df Scott Ullrich
25 5b237745 Scott Ullrich
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
26
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
27
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
29
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
	POSSIBILITY OF SUCH DAMAGE.
35
*/
36 7ac5a4cb Scott Ullrich
/*
37
	pfSense_BUILDER_BINARIES:	/usr/sbin/arp
38
	pfSense_MODULE:	interfaces
39
*/
40 5b237745 Scott Ullrich
41 6b07c15a Matthew Grooms
##|+PRIV
42 01eb687d Ermal Luçi
##|*IDENT=page-interfaces
43 6b07c15a Matthew Grooms
##|*NAME=Interfaces: WAN page
44 998552f8 Ermal Luçi
##|*DESCR=Allow access to the 'Interfaces' page.
45 01eb687d Ermal Luçi
##|*MATCH=interfaces.php*
46 6b07c15a Matthew Grooms
##|-PRIV
47
48 f81cfcc9 jim-p
require_once("guiconfig.inc");
49
require_once("ipsec.inc");
50
require_once("functions.inc");
51
require_once("captiveportal.inc");
52
require_once("filter.inc");
53
require_once("shaper.inc");
54
require_once("rrd.inc");
55
require_once("vpn.inc");
56 1fb064e8 Erik Fonnesbeck
require_once("xmlparse_attr.inc");
57 199d8121 Ermal Luçi
58 62424bdb Renato Botelho
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/interfaces.php');
59
60 94556105 Scott Ullrich
// Get configured interface list
61 dd18038e Ermal
$ifdescrs = get_configured_interface_with_descr(false, true);
62 94556105 Scott Ullrich
63 dd18038e Ermal
$if = "wan";
64
if ($_REQUEST['if'])
65 bd58d230 Scott Ullrich
	$if = $_REQUEST['if'];
66 dd18038e Ermal
67
if (empty($ifdescrs[$if])) {
68 6f3d2063 Renato Botelho
	header("Location: interfaces.php");
69 dd18038e Ermal
	exit;
70 9ff9a1c7 Seth Mos
}
71 6b07c15a Matthew Grooms
72 58af5941 Scott Ullrich
define("CRON_MONTHLY_PATTERN", "0 0 1 * *");
73
define("CRON_WEEKLY_PATTERN", "0 0 * * 0");
74
define("CRON_DAILY_PATTERN", "0 0 * * *");
75
define("CRON_HOURLY_PATTERN", "0 * * * *");
76 dc711694 Scott Ullrich
77 89c7a9c8 Ermal
if (!is_array($pconfig))
78
	$pconfig = array();
79
80 c4642eb1 Ermal LUÇI
if (!is_array($config['ppps']))
81
	$config['ppps'] = array();
82 d85ba87f gnhb
if (!is_array($config['ppps']['ppp']))
83
	$config['ppps']['ppp'] = array();
84
$a_ppps = &$config['ppps']['ppp'];
85 58af5941 Scott Ullrich
86 f1f60c92 Ermal Luçi
function remove_bad_chars($string) {
87 e7346f05 Erik Fonnesbeck
	return preg_replace('/[^a-z_0-9]/i','',$string);
88 f1f60c92 Ermal Luçi
}
89
90 d173230c Seth Mos
if (!is_array($config['gateways']['gateway_item']))
91
	$config['gateways']['gateway_item'] = array();
92
$a_gateways = &$config['gateways']['gateway_item'];
93
94 f1f60c92 Ermal Luçi
$wancfg = &$config['interfaces'][$if];
95 ee5c01b5 Seth Mos
$old_wancfg = $wancfg;
96 e12ad49f Renato Botelho
$old_wancfg['realif'] = get_real_interface($if);
97
$old_ppps = $a_ppps;
98 dd18038e Ermal
// Populate page descr if it does not exist.
99
if ($if == "wan" && !$wancfg['descr'])
100
	$wancfg['descr'] = "WAN";
101
else if ($if == "lan" && !$wancfg['descr'])
102
	$wancfg['descr'] = "LAN";
103
104 c4642eb1 Ermal LUÇI
/* NOTE: The code here is used to set the $pppid for the curious */
105 8256f324 gnhb
foreach ($a_ppps as $pppid => $ppp) {
106 1d7e1d6c gnhb
	if ($wancfg['if'] == $ppp['if'])
107 8256f324 gnhb
		break;
108 30ade846 gnhb
}
109
110 f3d88511 Renato Botelho
$type_disabled = (substr($wancfg['if'], 0, 3) == 'gre') ? 'disabled="disabled"' : '';
111
112 1d7e1d6c gnhb
if ($wancfg['if'] == $a_ppps[$pppid]['if']) {
113 30ade846 gnhb
	$pconfig['pppid'] = $pppid;
114 1d7e1d6c gnhb
	$pconfig['ptpid'] = $a_ppps[$pppid]['ptpid'];
115
	$pconfig['port'] = $a_ppps[$pppid]['ports'];
116 70e46e62 Ermal
	if ($a_ppps[$pppid]['type'] == "ppp") {
117 67877234 Phil Davis
		$pconfig['ppp_username'] = $a_ppps[$pppid]['username'];
118
		$pconfig['ppp_password'] = base64_decode($a_ppps[$pppid]['password']);
119 c0948c6c Renato Botelho
120 3a906378 gnhb
		$pconfig['phone'] = $a_ppps[$pppid]['phone'];
121
		$pconfig['apn'] = $a_ppps[$pppid]['apn'];
122
	}
123 70e46e62 Ermal
	else if ($a_ppps[$pppid]['type'] == "pppoe") {
124 d85ba87f gnhb
		$pconfig['pppoe_username'] = $a_ppps[$pppid]['username'];
125
		$pconfig['pppoe_password'] = base64_decode($a_ppps[$pppid]['password']);
126
		$pconfig['provider'] = $a_ppps[$pppid]['provider'];
127
		$pconfig['pppoe_dialondemand'] = isset($a_ppps[$pppid]['ondemand']);
128
		$pconfig['pppoe_idletimeout'] = $a_ppps[$pppid]['idletimeout'];
129 5b237745 Scott Ullrich
130 d85ba87f gnhb
		/* ================================================ */
131
		/* = force a connection reset at a specific time? = */
132
		/* ================================================ */
133 c0948c6c Renato Botelho
134 d85ba87f gnhb
		if (isset($a_ppps[$pppid]['pppoe-reset-type'])) {
135
			$pconfig['pppoe-reset-type'] = $a_ppps[$pppid]['pppoe-reset-type'];
136 1d7e1d6c gnhb
			$itemhash = getMPDCRONSettings($a_ppps[$pppid]['if']);
137 70e46e62 Ermal
			if ($itemhash)
138
				$cronitem = $itemhash['ITEM'];
139 e40e6724 gnhb
			if (isset($cronitem)) {
140
				$resetTime = "{$cronitem['minute']} {$cronitem['hour']} {$cronitem['mday']} {$cronitem['month']} {$cronitem['wday']}";
141
			} else {
142
				$resetTime = NULL;
143
			}
144 70e46e62 Ermal
			//log_error("ResetTime:".$resetTime);
145 d85ba87f gnhb
			if ($a_ppps[$pppid]['pppoe-reset-type'] == "custom") {
146 70e46e62 Ermal
				if ($cronitem) {
147
					$pconfig['pppoe_pr_custom'] = true;
148
					$pconfig['pppoe_resetminute'] = $cronitem['minute'];
149
					$pconfig['pppoe_resethour'] = $cronitem['hour'];
150
					if ($cronitem['mday'] <> "*" && $cronitem['month'] <> "*")
151
						$pconfig['pppoe_resetdate'] = "{$cronitem['month']}/{$cronitem['mday']}/" . date("Y");
152 af13aad6 Ermal
				}
153 d85ba87f gnhb
			} else if ($a_ppps[$pppid]['pppoe-reset-type'] == "preset") {
154
				$pconfig['pppoe_pr_preset'] = true;
155
				switch ($resetTime) {
156
					case CRON_MONTHLY_PATTERN:
157
						$pconfig['pppoe_monthly'] = true;
158
						break;
159
					case CRON_WEEKLY_PATTERN:
160
						$pconfig['pppoe_weekly'] = true;
161
						break;
162
					case CRON_DAILY_PATTERN:
163
						$pconfig['pppoe_daily'] = true;
164
						break;
165
					case CRON_HOURLY_PATTERN:
166
						$pconfig['pppoe_hourly'] = true;
167
						break;
168
				}
169
			}
170
		}// End force pppoe reset at specific time
171 c0948c6c Renato Botelho
	}// End if type == pppoe
172 e4d40f41 gnhb
	else if ($a_ppps[$pppid]['type'] == "pptp" || $a_ppps[$pppid]['type'] == "l2tp"){
173 d85ba87f gnhb
		$pconfig['pptp_username'] = $a_ppps[$pppid]['username'];
174
		$pconfig['pptp_password'] = base64_decode($a_ppps[$pppid]['password']);
175 4a1ee8ac gnhb
		$pconfig['pptp_local'] = explode(",",$a_ppps[$pppid]['localip']);
176
		$pconfig['pptp_subnet'] = explode(",",$a_ppps[$pppid]['subnet']);
177
		$pconfig['pptp_remote'] = explode(",",$a_ppps[$pppid]['gateway']);
178 d85ba87f gnhb
		$pconfig['pptp_dialondemand'] = isset($a_ppps[$pppid]['ondemand']);
179
		$pconfig['pptp_idletimeout'] = $a_ppps[$pppid]['timeout'];
180
	}
181 8256f324 gnhb
} else {
182 1d7e1d6c gnhb
	$pconfig['ptpid'] = interfaces_ptpid_next();
183 8256f324 gnhb
	$pppid = count($a_ppps);
184 d85ba87f gnhb
}
185 5b237745 Scott Ullrich
$pconfig['dhcphostname'] = $wancfg['dhcphostname'];
186 bc40d758 Seth Mos
$pconfig['alias-address'] = $wancfg['alias-address'];
187
$pconfig['alias-subnet'] = $wancfg['alias-subnet'];
188 57c83fd6 jim-p
$pconfig['dhcprejectfrom'] = $wancfg['dhcprejectfrom'];
189 f4dd8b4c N0YB
190
$pconfig['adv_dhcp_pt_timeout'] = $wancfg['adv_dhcp_pt_timeout'];
191
$pconfig['adv_dhcp_pt_retry'] = $wancfg['adv_dhcp_pt_retry'];
192
$pconfig['adv_dhcp_pt_select_timeout'] = $wancfg['adv_dhcp_pt_select_timeout'];
193
$pconfig['adv_dhcp_pt_reboot'] = $wancfg['adv_dhcp_pt_reboot'];
194
$pconfig['adv_dhcp_pt_backoff_cutoff'] = $wancfg['adv_dhcp_pt_backoff_cutoff'];
195
$pconfig['adv_dhcp_pt_initial_interval'] = $wancfg['adv_dhcp_pt_initial_interval'];
196
197
$pconfig['adv_dhcp_pt_values'] = $wancfg['adv_dhcp_pt_values'];
198
199
$pconfig['adv_dhcp_send_options'] = $wancfg['adv_dhcp_send_options'];
200
$pconfig['adv_dhcp_request_options'] = $wancfg['adv_dhcp_request_options'];
201
$pconfig['adv_dhcp_required_options'] = $wancfg['adv_dhcp_required_options'];
202
$pconfig['adv_dhcp_option_modifiers'] = $wancfg['adv_dhcp_option_modifiers'];
203
204
$pconfig['adv_dhcp_config_advanced'] = $wancfg['adv_dhcp_config_advanced'];
205
$pconfig['adv_dhcp_config_file_override'] = $wancfg['adv_dhcp_config_file_override'];
206
$pconfig['adv_dhcp_config_file_override_path'] = $wancfg['adv_dhcp_config_file_override_path'];
207
208
$pconfig['adv_dhcp6_interface_statement_send_options'] = $wancfg['adv_dhcp6_interface_statement_send_options'];
209
$pconfig['adv_dhcp6_interface_statement_request_options'] = $wancfg['adv_dhcp6_interface_statement_request_options'];
210
$pconfig['adv_dhcp6_interface_statement_information_only_enable'] = $wancfg['adv_dhcp6_interface_statement_information_only_enable'];
211
$pconfig['adv_dhcp6_interface_statement_script'] = $wancfg['adv_dhcp6_interface_statement_script'];
212
213
$pconfig['adv_dhcp6_id_assoc_statement_address_enable'] = $wancfg['adv_dhcp6_id_assoc_statement_address_enable'];
214
$pconfig['adv_dhcp6_id_assoc_statement_address'] = $wancfg['adv_dhcp6_id_assoc_statement_address'];
215
$pconfig['adv_dhcp6_id_assoc_statement_address_id'] = $wancfg['adv_dhcp6_id_assoc_statement_address_id'];
216
$pconfig['adv_dhcp6_id_assoc_statement_address_pltime'] = $wancfg['adv_dhcp6_id_assoc_statement_address_pltime'];
217
$pconfig['adv_dhcp6_id_assoc_statement_address_vltime'] = $wancfg['adv_dhcp6_id_assoc_statement_address_vltime'];
218
219
$pconfig['adv_dhcp6_id_assoc_statement_prefix_enable'] = $wancfg['adv_dhcp6_id_assoc_statement_prefix_enable'];
220
$pconfig['adv_dhcp6_id_assoc_statement_prefix'] = $wancfg['adv_dhcp6_id_assoc_statement_prefix'];
221
$pconfig['adv_dhcp6_id_assoc_statement_prefix_id'] = $wancfg['adv_dhcp6_id_assoc_statement_prefix_id'];
222
$pconfig['adv_dhcp6_id_assoc_statement_prefix_pltime'] = $wancfg['adv_dhcp6_id_assoc_statement_prefix_pltime'];
223
$pconfig['adv_dhcp6_id_assoc_statement_prefix_vltime'] = $wancfg['adv_dhcp6_id_assoc_statement_prefix_vltime'];
224
225
$pconfig['adv_dhcp6_prefix_interface_statement_sla_id'] = $wancfg['adv_dhcp6_prefix_interface_statement_sla_id'];
226
$pconfig['adv_dhcp6_prefix_interface_statement_sla_len'] = $wancfg['adv_dhcp6_prefix_interface_statement_sla_len'];
227
228
$pconfig['adv_dhcp6_authentication_statement_authname'] = $wancfg['adv_dhcp6_authentication_statement_authname'];
229
$pconfig['adv_dhcp6_authentication_statement_protocol'] = $wancfg['adv_dhcp6_authentication_statement_protocol'];
230
$pconfig['adv_dhcp6_authentication_statement_algorithm'] = $wancfg['adv_dhcp6_authentication_statement_algorithm'];
231
$pconfig['adv_dhcp6_authentication_statement_rdm'] = $wancfg['adv_dhcp6_authentication_statement_rdm'];
232
233
$pconfig['adv_dhcp6_key_info_statement_keyname'] = $wancfg['adv_dhcp6_key_info_statement_keyname'];
234
$pconfig['adv_dhcp6_key_info_statement_realm'] = $wancfg['adv_dhcp6_key_info_statement_realm'];
235
$pconfig['adv_dhcp6_key_info_statement_keyid'] = $wancfg['adv_dhcp6_key_info_statement_keyid'];
236
$pconfig['adv_dhcp6_key_info_statement_secret'] = $wancfg['adv_dhcp6_key_info_statement_secret'];
237
$pconfig['adv_dhcp6_key_info_statement_expire'] = $wancfg['adv_dhcp6_key_info_statement_expire'];
238
239
$pconfig['adv_dhcp6_config_advanced'] = $wancfg['adv_dhcp6_config_advanced'];
240
$pconfig['adv_dhcp6_config_file_override'] = $wancfg['adv_dhcp6_config_file_override'];
241
$pconfig['adv_dhcp6_config_file_override_path'] = $wancfg['adv_dhcp6_config_file_override_path'];
242
243 e4d40f41 gnhb
$pconfig['dhcp_plus'] = isset($wancfg['dhcp_plus']);
244 f1f60c92 Ermal Luçi
$pconfig['descr'] = remove_bad_chars($wancfg['descr']);
245 6a688547 Ermal
$pconfig['enable'] = isset($wancfg['enable']);
246 f1f60c92 Ermal Luçi
247 9ff9a1c7 Seth Mos
if (is_array($config['aliases']['alias'])) {
248
	foreach($config['aliases']['alias'] as $alias) {
249
		if($alias['name'] == $wancfg['descr']) {
250 ea6be4a7 Erik Fonnesbeck
			$input_errors[] = sprintf(gettext("Sorry, an alias with the name %s already exists."),$wancfg['descr']);
251 9ff9a1c7 Seth Mos
		}
252
	}
253
}
254
255
switch($wancfg['ipaddr']) {
256
	case "dhcp":
257
		$pconfig['type'] = "dhcp";
258
		break;
259
	case "pppoe":
260
	case "pptp":
261 e4d40f41 gnhb
	case "l2tp":
262 611ae852 Ermal
	case "ppp":
263 d85ba87f gnhb
		$pconfig['type'] = $wancfg['ipaddr'];
264 611ae852 Ermal
		break;
265 9ff9a1c7 Seth Mos
	default:
266 85e9cfee Phil Davis
		if(is_ipaddrv4($wancfg['ipaddr'])) {
267 47593ac6 Seth Mos
			$pconfig['type'] = "staticv4";
268 9ff9a1c7 Seth Mos
			$pconfig['ipaddr'] = $wancfg['ipaddr'];
269
			$pconfig['subnet'] = $wancfg['subnet'];
270
			$pconfig['gateway'] = $wancfg['gateway'];
271 dd18038e Ermal
		} else
272 9ff9a1c7 Seth Mos
			$pconfig['type'] = "none";
273
		break;
274
}
275 5b237745 Scott Ullrich
276 47593ac6 Seth Mos
switch($wancfg['ipaddrv6']) {
277 feb88a14 smos
	case "slaac":
278
		$pconfig['type6'] = "slaac";
279
		break;
280 e029943a Seth Mos
	case "dhcp6":
281
		$pconfig['dhcp6-duid'] = $wancfg['dhcp6-duid'];
282 8839e3fb bcyrill
		if(!isset($wancfg['dhcp6-ia-pd-len']))
283 e029943a Seth Mos
			$wancfg['dhcp6-ia-pd-len'] = "none";
284
		$pconfig['dhcp6-ia-pd-len'] = $wancfg['dhcp6-ia-pd-len'];
285 18f3c2fd Daniel Becker
		$pconfig['dhcp6-ia-pd-send-hint'] = isset($wancfg['dhcp6-ia-pd-send-hint']);
286 e029943a Seth Mos
		$pconfig['type6'] = "dhcp6";
287 a13acc0e smos
		$pconfig['dhcp6prefixonly'] = isset($wancfg['dhcp6prefixonly']);
288 dbb4e089 Ermal
		$pconfig['dhcp6usev4iface'] = isset($wancfg['dhcp6usev4iface']);
289 e029943a Seth Mos
		break;
290 31c43fd3 smos
	case "6to4":
291
		$pconfig['type6'] = "6to4";
292
		break;
293 20a7cb15 smos
	case "track6":
294
		$pconfig['type6'] = "track6";
295
		$pconfig['track6-interface'] = $wancfg['track6-interface'];
296 02203e6d Renato Botelho
		if ($wancfg['track6-prefix-id'] == "")
297
			$pconfig['track6-prefix-id'] = 0;
298
		else
299
			$pconfig['track6-prefix-id'] = $wancfg['track6-prefix-id'];
300
		$pconfig['track6-prefix-id--hex'] = sprintf("%x", $pconfig['track6-prefix-id']);
301 20a7cb15 smos
		break;
302 7d567088 smos
	case "6rd":
303
		$pconfig['prefix-6rd'] = $wancfg['prefix-6rd'];
304 12215bfb smos
		if($wancfg['prefix-6rd-v4plen'] == "")
305
			$wancfg['prefix-6rd-v4plen'] = "0";
306
		$pconfig['prefix-6rd-v4plen'] = $wancfg['prefix-6rd-v4plen'];
307 7d567088 smos
		$pconfig['type6'] = "6rd";
308
		$pconfig['gateway-6rd'] = $wancfg['gateway-6rd'];
309
		break;
310 47593ac6 Seth Mos
	default:
311 85e9cfee Phil Davis
		if(is_ipaddrv6($wancfg['ipaddrv6'])) {
312 e029943a Seth Mos
			$pconfig['type6'] = "staticv6";
313 47593ac6 Seth Mos
			$pconfig['ipaddrv6'] = $wancfg['ipaddrv6'];
314
			$pconfig['subnetv6'] = $wancfg['subnetv6'];
315
			$pconfig['gatewayv6'] = $wancfg['gatewayv6'];
316 e029943a Seth Mos
		} else
317
			$pconfig['type6'] = "none";
318 47593ac6 Seth Mos
		break;
319
}
320
321 0eb78676 smos
// print_r($pconfig);
322 47593ac6 Seth Mos
323 5b237745 Scott Ullrich
$pconfig['blockpriv'] = isset($wancfg['blockpriv']);
324 ff1955ee Bill Marquette
$pconfig['blockbogons'] = isset($wancfg['blockbogons']);
325 5b237745 Scott Ullrich
$pconfig['spoofmac'] = $wancfg['spoofmac'];
326
$pconfig['mtu'] = $wancfg['mtu'];
327 4cea5cf8 Ermal
$pconfig['mss'] = $wancfg['mss'];
328 5b237745 Scott Ullrich
329
/* Wireless interface? */
330 b7f01f59 Bill Marquette
if (isset($wancfg['wireless'])) {
331 ebf94efb Erik Fonnesbeck
	/* Sync first to be sure it displays the actual settings that will be used */
332
	interface_sync_wireless_clones($wancfg, false);
333 4634cb48 Ermal Luçi
	/* Get wireless modes */
334 10394059 Scott Ullrich
	$wlanif = get_real_interface($if);
335 3f23b74d Erik Fonnesbeck
	if (!does_interface_exist($wlanif))
336
		interface_wireless_clone($wlanif, $wancfg);
337 34808d4e Erik Fonnesbeck
	$wlanbaseif = interface_get_wireless_base($wancfg['if']);
338 6681fdd3 Erik Fonnesbeck
	preg_match("/^(.*?)([0-9]*)$/", $wlanbaseif, $wlanbaseif_split);
339 10394059 Scott Ullrich
	$wl_modes = get_wireless_modes($if);
340 f4094f0d Erik Fonnesbeck
	$wl_chaninfo = get_wireless_channel_info($if);
341 6681fdd3 Erik Fonnesbeck
	$wl_sysctl_prefix = 'dev.' . $wlanbaseif_split[1] . '.' . $wlanbaseif_split[2];
342 537bf7b3 Erik Fonnesbeck
	$wl_sysctl = get_sysctl(array("{$wl_sysctl_prefix}.diversity", "{$wl_sysctl_prefix}.txantenna", "{$wl_sysctl_prefix}.rxantenna",
343 6d529efd Renato Botelho
				      "{$wl_sysctl_prefix}.slottime", "{$wl_sysctl_prefix}.acktimeout", "{$wl_sysctl_prefix}.ctstimeout"));
344 071d63b9 Erik Fonnesbeck
	$wl_regdomain_xml_attr = array();
345
	$wl_regdomain_xml = parse_xml_regdomain($wl_regdomain_xml_attr);
346
	$wl_regdomains = &$wl_regdomain_xml['regulatory-domains']['rd'];
347
	$wl_regdomains_attr = &$wl_regdomain_xml_attr['regulatory-domains']['rd'];
348
	$wl_countries = &$wl_regdomain_xml['country-codes']['country'];
349
	$wl_countries_attr = &$wl_regdomain_xml_attr['country-codes']['country'];
350 f62c44d8 Erik Fonnesbeck
	$pconfig['persistcommonwireless'] = isset($config['wireless']['interfaces'][$wlanbaseif]);
351 4634cb48 Ermal Luçi
	$pconfig['standard'] = $wancfg['wireless']['standard'];
352
	$pconfig['mode'] = $wancfg['wireless']['mode'];
353
	$pconfig['protmode'] = $wancfg['wireless']['protmode'];
354 ff2f4e43 Ermal Luçi
	$pconfig['ssid'] = $wancfg['wireless']['ssid'];
355 4634cb48 Ermal Luçi
	$pconfig['channel'] = $wancfg['wireless']['channel'];
356
	$pconfig['txpower'] = $wancfg['wireless']['txpower'];
357 537bf7b3 Erik Fonnesbeck
	$pconfig['diversity'] = $wancfg['wireless']['diversity'];
358
	$pconfig['txantenna'] = $wancfg['wireless']['txantenna'];
359
	$pconfig['rxantenna'] = $wancfg['wireless']['rxantenna'];
360 4634cb48 Ermal Luçi
	$pconfig['distance'] = $wancfg['wireless']['distance'];
361 20f09b3b Erik Fonnesbeck
	$pconfig['regdomain'] = $wancfg['wireless']['regdomain'];
362
	$pconfig['regcountry'] = $wancfg['wireless']['regcountry'];
363
	$pconfig['reglocation'] = $wancfg['wireless']['reglocation'];
364 4634cb48 Ermal Luçi
	$pconfig['wme_enable'] = isset($wancfg['wireless']['wme']['enable']);
365 57bbd532 Erik Fonnesbeck
	if (isset($wancfg['wireless']['puren']['enable']))
366
		$pconfig['puremode'] = '11n';
367
	else if (isset($wancfg['wireless']['pureg']['enable']))
368
		$pconfig['puremode'] = '11g';
369
	else
370
		$pconfig['puremode'] = 'any';
371 4634cb48 Ermal Luçi
	$pconfig['apbridge_enable'] = isset($wancfg['wireless']['apbridge']['enable']);
372
	$pconfig['authmode'] = $wancfg['wireless']['authmode'];
373
	$pconfig['hidessid_enable'] = isset($wancfg['wireless']['hidessid']['enable']);
374 5949124c Scott Ullrich
	$pconfig['auth_server_addr'] = $wancfg['wireless']['auth_server_addr'];
375
	$pconfig['auth_server_port'] = $wancfg['wireless']['auth_server_port'];
376
	$pconfig['auth_server_shared_secret'] = $wancfg['wireless']['auth_server_shared_secret'];
377 32764288 Namezero
	$pconfig['auth_server_addr2'] = $wancfg['wireless']['auth_server_addr2'];
378
	$pconfig['auth_server_port2'] = $wancfg['wireless']['auth_server_port2'];
379
	$pconfig['auth_server_shared_secret2'] = $wancfg['wireless']['auth_server_shared_secret2'];
380 4634cb48 Ermal Luçi
	if (is_array($wancfg['wireless']['wpa'])) {
381
		$pconfig['debug_mode'] = $wancfg['wireless']['wpa']['debug_mode'];
382
		$pconfig['macaddr_acl'] = $wancfg['wireless']['wpa']['macaddr_acl'];
383
		$pconfig['mac_acl_enable'] = isset($wancfg['wireless']['wpa']['mac_acl_enable']);
384
		$pconfig['auth_algs'] = $wancfg['wireless']['wpa']['auth_algs'];
385
		$pconfig['wpa_mode'] = $wancfg['wireless']['wpa']['wpa_mode'];
386
		$pconfig['wpa_key_mgmt'] = $wancfg['wireless']['wpa']['wpa_key_mgmt'];
387
		$pconfig['wpa_pairwise'] = $wancfg['wireless']['wpa']['wpa_pairwise'];
388
		$pconfig['wpa_group_rekey'] = $wancfg['wireless']['wpa']['wpa_group_rekey'];
389
		$pconfig['wpa_gmk_rekey'] = $wancfg['wireless']['wpa']['wpa_gmk_rekey'];
390
		$pconfig['wpa_strict_rekey'] = isset($wancfg['wireless']['wpa']['wpa_strict_rekey']);
391
		$pconfig['passphrase'] = $wancfg['wireless']['wpa']['passphrase'];
392 bfe1ef8c Ermal Luçi
		$pconfig['ieee8021x'] = isset($wancfg['wireless']['wpa']['ieee8021x']['enable']);
393 ea62cd32 Scott Ullrich
		$pconfig['rsn_preauth'] = isset($wancfg['wireless']['wpa']['rsn_preauth']);
394 4634cb48 Ermal Luçi
		$pconfig['ext_wpa_sw'] = $wancfg['wireless']['wpa']['ext_wpa_sw'];
395
		$pconfig['wpa_enable'] = isset($wancfg['wireless']['wpa']['enable']);
396
	}
397
	$pconfig['wep_enable'] = isset($wancfg['wireless']['wep']['enable']);
398
	$pconfig['mac_acl'] = $wancfg['wireless']['mac_acl'];
399 270c4607 Scott Ullrich
	if (is_array($wancfg['wireless']['wep']) && is_array($wancfg['wireless']['wep']['key'])) {
400 53c82ef9 Scott Ullrich
		$i = 1;
401
		foreach ($wancfg['wireless']['wep']['key'] as $wepkey) {
402
			$pconfig['key' . $i] = $wepkey['value'];
403
			if (isset($wepkey['txkey']))
404
				$pconfig['txkey'] = $i;
405
			$i++;
406
		}
407
		if (!isset($wepkey['txkey']))
408
			$pconfig['txkey'] = 1;
409 4634cb48 Ermal Luçi
	}
410 5b237745 Scott Ullrich
}
411
412 43e255d2 Ermal Luçi
if ($_POST['apply']) {
413 7994c3f8 Ermal Luçi
	unset($input_errors);
414 a368a026 Ermal Lu?i
	if (!is_subsystem_dirty('interfaces'))
415 a19cc600 Chris Buechler
		$input_errors[] = gettext("You have already applied your settings!");
416 c0948c6c Renato Botelho
	else {
417 270c4607 Scott Ullrich
		unlink_if_exists("{$g['tmp_path']}/config.cache");
418 a368a026 Ermal Lu?i
		clear_subsystem_dirty('interfaces');
419 c0948c6c Renato Botelho
420 dd18038e Ermal
		if (file_exists("{$g['tmp_path']}/.interfaces.apply")) {
421
			$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.interfaces.apply"));
422 18f338da Ermal Lu?i
			foreach ($toapplylist as $ifapply => $ifcfgo) {
423 d9797fd6 Renato Botelho
				if (isset($config['interfaces'][$ifapply]['enable'])) {
424
					interface_bring_down($ifapply, false, $ifcfgo);
425 613a3cc5 Renato Botelho
					interface_configure($ifapply, true);
426 f4c40620 Renato Botelho
				} else {
427 d9797fd6 Renato Botelho
					interface_bring_down($ifapply, true, $ifcfgo);
428 f4c40620 Renato Botelho
					if (isset($config['dhcpd'][$ifapply]['enable']) ||
429
					    isset($config['dhcpdv6'][$ifapply]['enable']))
430
						services_dhcpd_configure();
431
				}
432 dd18038e Ermal
			}
433
		}
434 c0948c6c Renato Botelho
		/* restart snmp so that it binds to correct address */
435
		services_snmpd_configure();
436 a5d6f60b Ermal Lu?i
437 270c4607 Scott Ullrich
		/* sync filter configuration */
438 61fc1160 Scott Ullrich
		setup_gateways_monitor();
439 a5d6f60b Ermal Lu?i
440 18f338da Ermal Lu?i
		clear_subsystem_dirty('interfaces');
441 c0948c6c Renato Botelho
442 b4d36392 Scott Ullrich
		filter_configure();
443 c0948c6c Renato Botelho
444 1ee5d4b3 sullrich
		enable_rrd_graphing();
445 244dee81 Renato Botelho
446
		if (is_subsystem_dirty('staticroutes') && (system_routing_configure() == 0))
447
			clear_subsystem_dirty('staticroutes');
448 7994c3f8 Ermal Luçi
	}
449 dd18038e Ermal
	@unlink("{$g['tmp_path']}/.interfaces.apply");
450 7994c3f8 Ermal Luçi
	header("Location: interfaces.php?if={$if}");
451
	exit;
452 dd18038e Ermal
} else if ($_POST && $_POST['enable'] != "yes") {
453 270c4607 Scott Ullrich
	unset($wancfg['enable']);
454 dd18038e Ermal
	if (isset($wancfg['wireless']))
455 8f0289e7 Erik Fonnesbeck
		interface_sync_wireless_clones($wancfg, false);
456 270c4607 Scott Ullrich
	write_config("Interface {$_POST['descr']}({$if}) is now disabled.");
457 a368a026 Ermal Lu?i
	mark_subsystem_dirty('interfaces');
458 ee5c01b5 Seth Mos
	if (file_exists("{$g['tmp_path']}/.interfaces.apply")) {
459 dd18038e Ermal
		$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.interfaces.apply"));
460 ee5c01b5 Seth Mos
	} else {
461 dd18038e Ermal
		$toapplylist = array();
462 ee5c01b5 Seth Mos
	}
463 e12ad49f Renato Botelho
	$toapplylist[$if]['ifcfg'] = $wancfg;
464
	$toapplylist[$if]['ppps'] = $a_ppps;
465 ee5c01b5 Seth Mos
	/* we need to be able remove IP aliases for IPv6 */
466 dd18038e Ermal
	file_put_contents("{$g['tmp_path']}/.interfaces.apply", serialize($toapplylist));
467 270c4607 Scott Ullrich
	header("Location: interfaces.php?if={$if}");
468
	exit;
469 dd18038e Ermal
} else if ($_POST) {
470 270c4607 Scott Ullrich
471 53c82ef9 Scott Ullrich
	unset($input_errors);
472
	$pconfig = $_POST;
473 aeb44799 Renato Botelho
474 02203e6d Renato Botelho
	if (is_numeric("0x" . $_POST['track6-prefix-id--hex']))
475 6b2d4b5a Darren Embry
		$pconfig['track6-prefix-id'] = intval($_POST['track6-prefix-id--hex'], 16);
476 02203e6d Renato Botelho
	else
477
		$pconfig['track6-prefix-id'] = 0;
478 53c82ef9 Scott Ullrich
	conf_mount_rw();
479 fe24301f Ermal
480 53c82ef9 Scott Ullrich
	/* filter out spaces from descriptions  */
481
	$_POST['descr'] = remove_bad_chars($_POST['descr']);
482 fe24301f Ermal
483 b4d36392 Scott Ullrich
	/* okay first of all, cause we are just hiding the PPPoE HTML
484 53c82ef9 Scott Ullrich
	 * fields releated to PPPoE resets, we are going to unset $_POST
485
	 * vars, if the reset feature should not be used. Otherwise the
486
	 * data validation procedure below, may trigger a false error
487
	 * message.
488
	 */
489 e40e6724 gnhb
	if (empty($_POST['pppoe-reset-type'])) {
490 c0948c6c Renato Botelho
		unset($_POST['pppoe_pr_type']);
491 53c82ef9 Scott Ullrich
		unset($_POST['pppoe_resethour']);
492
		unset($_POST['pppoe_resetminute']);
493
		unset($_POST['pppoe_resetdate']);
494
		unset($_POST['pppoe_pr_preset_val']);
495
	}
496
	/* description unique? */
497 dd18038e Ermal
	foreach ($ifdescrs as $ifent => $ifdescr) {
498 79851fc8 Ermal
		if ($if != $ifent && $ifdescr == $_POST['descr']) {
499 136c598d Carlos Eduardo Ramos
			$input_errors[] = gettext("An interface with the specified description already exists.");
500 79851fc8 Ermal
			break;
501
		}
502 53c82ef9 Scott Ullrich
	}
503 71f45fed Chris Buechler
	if(is_numeric($_POST['descr'])) {
504
		$input_errors[] = gettext("The interface description cannot contain only numbers.");
505
	}
506 53c82ef9 Scott Ullrich
	/* input validation */
507 e029943a Seth Mos
	if (isset($config['dhcpd']) && isset($config['dhcpd'][$if]['enable']) && (! preg_match("/^staticv4/", $_POST['type'])))
508 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.");
509 1f56ce58 Renato Botelho
	if (isset($config['dhcpdv6']) && isset($config['dhcpdv6'][$if]['enable']) && (! preg_match("/^staticv6/", $_POST['type6'])))
510 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.");
511 0c9da721 Ermal Lu?i
512 ef130e9f Ermal
	switch(strtolower($_POST['type'])) {
513 47593ac6 Seth Mos
		case "staticv4":
514 9ff9a1c7 Seth Mos
			$reqdfields = explode(" ", "ipaddr subnet gateway");
515 47593ac6 Seth Mos
			$reqdfieldsn = array(gettext("IPv4 address"),gettext("Subnet bit count"),gettext("Gateway"));
516 1e9b4611 Renato Botelho
			do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
517 47593ac6 Seth Mos
			break;
518 88c00a65 Ermal
		case "none":
519 62a4abc9 Ermal
			if(is_array($config['virtualip']['vip'])) {
520
				foreach ($config['virtualip']['vip'] as $vip) {
521 2452cc37 Darren Embry
					if (is_ipaddrv4($vip['subnet']) && $vip['interface'] == $if)
522
						$input_errors[] = gettext("This interface is referenced by IPv4 VIPs. Please delete those before setting the interface to 'none' configuration.");
523 62a4abc9 Ermal
				}
524
			}
525 5bd0ba3e jim-p
			break;
526 513b762e gnhb
		case "ppp":
527
			$reqdfields = explode(" ", "port phone");
528 8cc6876f groo
			$reqdfieldsn = array(gettext("Modem Port"),gettext("Phone Number"));
529 1e9b4611 Renato Botelho
			do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
530 513b762e gnhb
			break;
531 ef130e9f Ermal
		case "pppoe":
532 9ff9a1c7 Seth Mos
			if ($_POST['pppoe_dialondemand']) {
533
				$reqdfields = explode(" ", "pppoe_username pppoe_password pppoe_dialondemand pppoe_idletimeout");
534 8cc6876f groo
				$reqdfieldsn = array(gettext("PPPoE username"),gettext("PPPoE password"),gettext("Dial on demand"),gettext("Idle timeout value"));
535 9ff9a1c7 Seth Mos
			} else {
536
				$reqdfields = explode(" ", "pppoe_username pppoe_password");
537 8cc6876f groo
				$reqdfieldsn = array(gettext("PPPoE username"),gettext("PPPoE password"));
538 9ff9a1c7 Seth Mos
			}
539 1e9b4611 Renato Botelho
			do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
540 9ff9a1c7 Seth Mos
			break;
541 ef130e9f Ermal
		case "pptp":
542 9ff9a1c7 Seth Mos
			if ($_POST['pptp_dialondemand']) {
543
				$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote pptp_dialondemand pptp_idletimeout");
544 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"));
545 9ff9a1c7 Seth Mos
			} else {
546
				$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote");
547 8cc6876f groo
				$reqdfieldsn = array(gettext("PPTP username"),gettext("PPTP password"),gettext("PPTP local IP address"),gettext("PPTP subnet"),gettext("PPTP remote IP address"));
548 9ff9a1c7 Seth Mos
			}
549 1e9b4611 Renato Botelho
			do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
550 9ff9a1c7 Seth Mos
			break;
551 e4d40f41 gnhb
		case "l2tp":
552
			if ($_POST['pptp_dialondemand']) {
553
				$reqdfields = explode(" ", "pptp_username pptp_password pptp_remote pptp_dialondemand pptp_idletimeout");
554
				$reqdfieldsn = array(gettext("L2TP username"),gettext("L2TP password"),gettext("L2TP remote IP address"),gettext("Dial on demand"),gettext("Idle timeout value"));
555
			} else {
556
				$reqdfields = explode(" ", "pptp_username pptp_password pptp_remote");
557
				$reqdfieldsn = array(gettext("L2TP username"),gettext("L2TP password"),gettext("L2TP remote IP address"));
558
			}
559 1e9b4611 Renato Botelho
			do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
560 e4d40f41 gnhb
			break;
561 53c82ef9 Scott Ullrich
	}
562 e029943a Seth Mos
	switch(strtolower($_POST['type6'])) {
563
		case "staticv6":
564 20b49b17 Seth Mos
			$reqdfields = explode(" ", "ipaddrv6 subnetv6 gatewayv6");
565 1e37f324 smos
			$reqdfieldsn = array(gettext("IPv6 address"),gettext("Subnet bit count"),gettext("Gateway"));
566 1e9b4611 Renato Botelho
			do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
567 e029943a Seth Mos
			break;
568
		case "none":
569
			if(is_array($config['virtualip']['vip'])) {
570
				foreach ($config['virtualip']['vip'] as $vip) {
571 2452cc37 Darren Embry
					if (is_ipaddrv6($vip['subnet']) && $vip['interface'] == $if)
572
						$input_errors[] = gettext("This interface is referenced by IPv6 VIPs. Please delete those before setting the interface to 'none' configuration.");
573 e029943a Seth Mos
				}
574
			}
575 5bd0ba3e jim-p
			break;
576 e029943a Seth Mos
		case "dhcp6":
577
			if (in_array($wancfg['ipaddrv6'], array()))
578 8b198c64 smos
				$input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."),$_POST['type6']);
579 e029943a Seth Mos
			break;
580 7d567088 smos
		case "6rd":
581 8b198c64 smos
			foreach ($ifdescrs as $ifent => $ifdescr) {
582 dcddb2fa Ermal
				if ($if != $ifent && ($config[interfaces][$ifent]['ipaddrv6'] == $_POST['type6'])) {
583
					if ($config[interfaces][$ifent]['prefix-6rd'] == $_POST['prefix-6rd']) {
584
						$input_errors[] = gettext("You can only have one interface configured in 6rd with same prefix.");
585
						break;
586
					}
587 8b198c64 smos
				}
588
			}
589 7d567088 smos
			if (in_array($wancfg['ipaddrv6'], array()))
590 8b198c64 smos
				$input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."),$_POST['type6']);
591 7d567088 smos
			break;
592 31c43fd3 smos
		case "6to4":
593 8b198c64 smos
			foreach ($ifdescrs as $ifent => $ifdescr) {
594 dcddb2fa Ermal
				if ($if != $ifent && ($config[interfaces][$ifent]['ipaddrv6'] == $_POST['type6'])) {
595
					$input_errors[] = sprintf(gettext("You can only have one interface configured as 6to4."),$_POST['type6']);
596 8b198c64 smos
					break;
597
				}
598
			}
599 31c43fd3 smos
			if (in_array($wancfg['ipaddrv6'], array()))
600 8b198c64 smos
				$input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."),$_POST['type6']);
601 31c43fd3 smos
			break;
602 20a7cb15 smos
		case "track6":
603
			/* needs to check if $track6-prefix-id is used on another interface */
604
			if (in_array($wancfg['ipaddrv6'], array()))
605 8b198c64 smos
				$input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."),$_POST['type6']);
606 6b2d4b5a Darren Embry
607
			if ($_POST['track6-prefix-id--hex'] != "" && !is_numeric("0x" . $_POST['track6-prefix-id--hex'])) {
608
				$input_errors[] = gettext("You must enter a valid hexadecimal number for the IPv6 prefix ID.");
609
			} else {
610
				$track6_prefix_id = intval($_POST['track6-prefix-id--hex'], 16);
611 eef5aeeb Renato Botelho
				if ($track6_prefix_id < 0 || $track6_prefix_id > $_POST['ipv6-num-prefix-ids-' . $_POST['track6-interface']]) {
612 aa2370d8 Renato Botelho
					$input_errors[] = gettext("You specified an IPv6 prefix ID that is out of range.") .
613
						" ({$_POST['track6-interface']}) - (0) - (" . sprintf('%x', $_POST['ipv6-num-prefix-ids-' . $_POST['track6-interface']]) . ")";
614 986fd3d9 Renato Botelho
				} else {
615
					foreach ($ifdescrs as $ifent => $ifdescr) {
616
						if ($if == $ifent)
617
							continue;
618
						if ($config['interfaces'][$ifent]['ipaddrv6'] == 'track6' &&
619
						    $config['interfaces'][$ifent]['track6-interface'] == $_POST['track6-interface'] &&
620
						    $config['interfaces'][$ifent]['track6-prefix-id'] == $track6_prefix_id)
621 b25ccd04 Chris Buechler
							$input_errors[] = sprintf(gettext("This track6 prefix ID is already being used in %s."), $ifdescr);
622 986fd3d9 Renato Botelho
					}
623 6b2d4b5a Darren Embry
				}
624
			}
625 20a7cb15 smos
			break;
626 e029943a Seth Mos
	}
627 9ff9a1c7 Seth Mos
628 6d529efd Renato Botelho
629 53c82ef9 Scott Ullrich
	/* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */
630 42fa2c01 Renato Botelho
	$staticroutes = get_staticroutes(true);
631 53c82ef9 Scott Ullrich
	$_POST['spoofmac'] = strtolower(str_replace("-", ":", $_POST['spoofmac']));
632 e6c60013 Renato Botelho
	if ($_POST['ipaddr']) {
633
		if (!is_ipaddrv4($_POST['ipaddr']))
634
			$input_errors[] = gettext("A valid IPv4 address must be specified.");
635 42fa2c01 Renato Botelho
		else {
636
			if (is_ipaddr_configured($_POST['ipaddr'], $if, true))
637
				$input_errors[] = gettext("This IPv4 address is being used by another interface or VIP.");
638
639 20dda766 Renato Botelho
			/* Do not accept network or broadcast address, except if subnet is 31 or 32 */
640
			if ($_POST['subnet'] < 31) {
641
				if ($_POST['ipaddr'] == gen_subnet($_POST['ipaddr'], $_POST['subnet']))
642
					$input_errors[] = gettext("This IPv4 address is the network address and cannot be used");
643
				else if ($_POST['ipaddr'] == gen_subnet_max($_POST['ipaddr'], $_POST['subnet']))
644
					$input_errors[] = gettext("This IPv4 address is the broadcast address and cannot be used");
645
			}
646
647 42fa2c01 Renato Botelho
			foreach ($staticroutes as $route_subnet) {
648 e480d64b Renato Botelho
				list($network, $subnet) = explode("/", $route_subnet);
649
				if ($_POST['subnet'] == $subnet && $network == gen_subnet($_POST['ipaddr'], $_POST['subnet'])) {
650 42fa2c01 Renato Botelho
					$input_errors[] = gettext("This IPv4 address conflicts with a Static Route.");
651
					break;
652
				}
653 e480d64b Renato Botelho
				unset($network, $subnet);
654 42fa2c01 Renato Botelho
			}
655
		}
656 e6c60013 Renato Botelho
	}
657 6e828f98 Renato Botelho
	if ($_POST['ipaddrv6']) {
658
		if (!is_ipaddrv6($_POST['ipaddrv6']))
659
			$input_errors[] = gettext("A valid IPv6 address must be specified.");
660 42fa2c01 Renato Botelho
		else {
661
			if (is_ipaddr_configured($_POST['ipaddrv6'], $if, true))
662
				$input_errors[] = gettext("This IPv6 address is being used by another interface or VIP.");
663
664
			foreach ($staticroutes as $route_subnet) {
665 e480d64b Renato Botelho
				list($network, $subnet) = explode("/", $route_subnet);
666
				if ($_POST['subnetv6'] == $subnet && $network == gen_subnetv6($_POST['ipaddrv6'], $_POST['subnetv6'])) {
667 42fa2c01 Renato Botelho
					$input_errors[] = gettext("This IPv6 address conflicts with a Static Route.");
668
					break;
669
				}
670 e480d64b Renato Botelho
				unset($network, $subnet);
671 42fa2c01 Renato Botelho
			}
672
		}
673 6e828f98 Renato Botelho
	}
674 c0948c6c Renato Botelho
	if (($_POST['subnet'] && !is_numeric($_POST['subnet'])))
675 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("A valid subnet bit count must be specified.");
676 47593ac6 Seth Mos
	if (($_POST['subnetv6'] && !is_numeric($_POST['subnetv6'])))
677
		$input_errors[] = gettext("A valid subnet bit count must be specified.");
678 85e9cfee Phil Davis
	if (($_POST['alias-address'] && !is_ipaddrv4($_POST['alias-address'])))
679 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("A valid alias IP address must be specified.");
680 c0948c6c Renato Botelho
	if (($_POST['alias-subnet'] && !is_numeric($_POST['alias-subnet'])))
681 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("A valid alias subnet bit count must be specified.");
682 57c83fd6 jim-p
	if ($_POST['dhcprejectfrom'] && !is_ipaddrv4($_POST['dhcprejectfrom']))
683
		$input_errors[] = gettext("A valid alias IP address must be specified to reject DHCP Leases from.");
684 47593ac6 Seth Mos
	if (($_POST['gateway'] != "none") || ($_POST['gatewayv6'] != "none")) {
685 53c82ef9 Scott Ullrich
		$match = false;
686 9ff9a1c7 Seth Mos
		foreach($a_gateways as $gateway) {
687
			if(in_array($_POST['gateway'], $gateway)) {
688 53c82ef9 Scott Ullrich
				$match = true;
689 9ff9a1c7 Seth Mos
			}
690
		}
691 47593ac6 Seth Mos
		foreach($a_gateways as $gateway) {
692
			if(in_array($_POST['gatewayv6'], $gateway)) {
693
				$match = true;
694
			}
695
		}
696 9ff9a1c7 Seth Mos
		if(!$match) {
697 136c598d Carlos Eduardo Ramos
			$input_errors[] = gettext("A valid gateway must be specified.");
698 9ff9a1c7 Seth Mos
		}
699 53c82ef9 Scott Ullrich
	}
700 c0948c6c Renato Botelho
	if (($_POST['provider'] && !is_domain($_POST['provider'])))
701 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("The service name contains invalid characters.");
702 c0948c6c Renato Botelho
	if (($_POST['pppoe_idletimeout'] != "") && !is_numericint($_POST['pppoe_idletimeout']))
703 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("The idle timeout value must be an integer.");
704 c0948c6c Renato Botelho
	if ($_POST['pppoe_resethour'] <> "" && !is_numericint($_POST['pppoe_resethour']) &&
705
		$_POST['pppoe_resethour'] >= 0 && $_POST['pppoe_resethour'] <=23)
706 53c82ef9 Scott Ullrich
			$input_errors[] = gettext("A valid PPPoE reset hour must be specified (0-23).");
707 c0948c6c Renato Botelho
	if ($_POST['pppoe_resetminute'] <> "" && !is_numericint($_POST['pppoe_resetminute']) &&
708
		$_POST['pppoe_resetminute'] >= 0 && $_POST['pppoe_resetminute'] <=59)
709 53c82ef9 Scott Ullrich
			$input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59).");
710 c0948c6c Renato Botelho
	if ($_POST['pppoe_resetdate'] <> "" && !is_numeric(str_replace("/", "", $_POST['pppoe_resetdate'])))
711 53c82ef9 Scott Ullrich
		$input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy).");
712 85e9cfee Phil Davis
	if (($_POST['pptp_local'] && !is_ipaddrv4($_POST['pptp_local'])))
713 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("A valid PPTP local IP address must be specified.");
714 c0948c6c Renato Botelho
	if (($_POST['pptp_subnet'] && !is_numeric($_POST['pptp_subnet'])))
715 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("A valid PPTP subnet bit count must be specified.");
716 85e9cfee Phil Davis
	if (($_POST['pptp_remote'] && !is_ipaddrv4($_POST['pptp_remote']) && !is_hostname($_POST['gateway'][$iface])))
717 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("A valid PPTP remote IP address must be specified.");
718 c0948c6c Renato Botelho
	if (($_POST['pptp_idletimeout'] != "") && !is_numericint($_POST['pptp_idletimeout']))
719 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("The idle timeout value must be an integer.");
720 c0948c6c Renato Botelho
	if (($_POST['spoofmac'] && !is_macaddr($_POST['spoofmac'])))
721 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("A valid MAC address must be specified.");
722 0d0d4a27 Renato Botelho
	if ($_POST['mtu']) {
723 c5cd9b75 Chris Buechler
		if (!is_numericint($_POST['mtu']))
724
			$input_errors[] = "MTU must be an integer.";
725 1c764a3a Renato Botelho
		if (substr($wancfg['if'], 0, 3) == 'gif') {
726
			$min_mtu = 1280;
727
			$max_mtu = 8192;
728
		} else {
729
			$min_mtu = 576;
730
			$max_mtu = 9000;
731
		}
732
733
		if ($_POST['mtu'] < $min_mtu || $_POST['mtu'] > $max_mtu)
734 c5cd9b75 Chris Buechler
			$input_errors[] = sprintf(gettext("The MTU must be between %d and %d bytes."), $min_mtu, $max_mtu);
735 1c764a3a Renato Botelho
736
		unset($min_mtu, $max_mtu);
737 0d0d4a27 Renato Botelho
738 a58a9ece Ermal
		if (stristr($wancfg['if'], "_vlan")) {
739 0d0d4a27 Renato Botelho
			$realhwif_array = get_parent_interface($wancfg['if']);
740
			// Need code to handle MLPPP if we ever use $realhwif for MLPPP handling
741
			$parent_realhwif = $realhwif_array[0];
742
			$parent_if = convert_real_interface_to_friendly_interface_name($parent_realhwif);
743 5e0a3256 Ermal LUÇI
			if (!empty($parent_if) && !empty($config['interfaces'][$parent_if]['mtu'])) {
744 f6d89471 Ermal
				if ($_POST['mtu'] > intval($config['interfaces'][$parent_if]['mtu']))
745 2b114010 Chris Buechler
					$input_errors[] = gettext("The MTU of a VLAN cannot be greater than that of its parent interface.");
746 0d0d4a27 Renato Botelho
			}
747
		} else {
748
			foreach ($config['interfaces'] as $idx => $ifdata) {
749
				if (($idx == $if) || !preg_match('/_vlan[0-9]/', $ifdata['if']))
750
					continue;
751
752
				$realhwif_array = get_parent_interface($ifdata['if']);
753
				// Need code to handle MLPPP if we ever use $realhwif for MLPPP handling
754
				$parent_realhwif = $realhwif_array[0];
755
756
				if ($parent_realhwif != $wancfg['if'])
757
					continue;
758
759
				if (isset($ifdata['mtu']) && $ifdata['mtu'] > $_POST['mtu'])
760 c5cd9b75 Chris Buechler
					$input_errors[] = sprintf(gettext("Interface %s (VLAN) has MTU set to a larger value"), $ifdata['descr']);
761 0d0d4a27 Renato Botelho
			}
762
		}
763
	}
764 c5cd9b75 Chris Buechler
	if ($_POST['mss'] <> '')
765
		if (!is_numericint($_POST['mss']) || ($_POST['mss'] < 576 || $_POST['mss'] > 65535))
766
			$input_errors[] = gettext("The MSS must be an integer between 576 and 65535 bytes.");
767 53c82ef9 Scott Ullrich
	/* Wireless interface? */
768
	if (isset($wancfg['wireless'])) {
769 bb9d70d2 Erik Fonnesbeck
		$reqdfields = array("mode");
770
		$reqdfieldsn = array(gettext("Mode"));
771
		if ($_POST['mode'] == 'hostap') {
772
			$reqdfields[] = "ssid";
773
			$reqdfieldsn[] = gettext("SSID");
774 6f5607f5 Chris Buechler
			if (isset($_POST['channel']) && $_POST['channel'] == "0") {
775
				// auto channel with hostap is broken, prevent this for now.
776
				$input_errors[] = gettext("A specific channel, not auto, must be selected for Access Point mode.");
777
			}
778 bb9d70d2 Erik Fonnesbeck
		}
779 0a950c4b Chris Buechler
		if (stristr($_POST['standard'], '11n')) {
780
			if (!($_POST['wme_enable'])) {
781
				$input_errors[] = gettext("802.11n standards require enabling WME.");
782
			}
783
		}
784 1e9b4611 Renato Botelho
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
785 597330aa Erik Fonnesbeck
		check_wireless_mode();
786 95df2de5 Chris Buechler
		if (isset($_POST['wpa_group_rekey']) && (!is_numericint($_POST['wpa_group_rekey']) || $_POST['wpa_group_rekey'] < 1 || $_POST['wpa_group_rekey'] > 9999)) {
787
			$input_errors[] = gettext("Key Rotation must be an integer between 1 and 9999.");
788
		}
789
		if (isset($_POST['wpa_gmk_rekey']) && (!is_numericint($_POST['wpa_gmk_rekey']) || $_POST['wpa_gmk_rekey'] < 1 || $_POST['wpa_gmk_rekey'] > 9999)) {
790
			$input_errors[] = gettext("Master Key Regeneration must be an integer between 1 and 9999.");
791
		}
792
		if (isset($_POST['wpa_group_rekey']) && isset($_POST['wpa_gmk_rekey'])) {
793
			if ($_POST['wpa_group_rekey'] > $_POST['wpa_gmk_rekey']) {
794
				$input_errors[] = gettext("Master Key Regeneration must be greater than Key Rotation.");
795
			}
796
		}
797
		if (!empty($_POST['auth_server_addr'])) {
798
			if (!is_domain($_POST['auth_server_addr']) && !is_ipaddr($_POST['auth_server_addr'])) {
799
				$input_errors[] = gettext("802.1X Authentication Server must be an IP or hostname.");
800
			}
801
		}
802
		if (!empty($_POST['auth_server_addr2'])) {
803
			if (!is_domain($_POST['auth_server_addr2']) && !is_ipaddr($_POST['auth_server_addr2'])) {
804
				$input_errors[] = gettext("Secondary 802.1X Authentication Server must be an IP or hostname.");
805
			}
806
		}
807
		if (!empty($_POST['auth_server_port'])) {
808
			if (!is_port($_POST['auth_server_port'])) {
809
				$input_errors[] = gettext("802.1X Authentication Server Port must be a valid port number (1-65535).");
810
			}
811
		}
812
		if (!empty($_POST['auth_server_port2'])) {
813
			if (!is_port($_POST['auth_server_port2'])) {
814
				$input_errors[] = gettext("Secondary 802.1X Authentication Server Port must be a valid port number (1-65535).");
815
			}
816
		}
817 6cd14b43 Chris Buechler
		if (isset($_POST['channel']) && !is_numericint($_POST['channel'])) {
818
			if (!is_numericint($_POST['channel'])) {
819
				$input_errors[] = gettext("Invalid channel specified.");
820
			} else {
821
				if ($_POST['channel'] > 255 || $_POST['channel'] < 0) {
822
					$input_errors[] = gettext("Channel must be between 0-255.");
823
				}
824
			}
825
		}
826
		if (!empty($_POST['distance']) && !is_numericint($_POST['distance'])) {
827
			$input_errors[] = gettext("Distance must be an integer.");
828
		}
829
		if (isset($_POST['standard']) && (stristr($_POST['standard'], '11na') || stristr($_POST['standard'], '11a'))) {
830
			if ($_POST['channel'] != 0 && $_POST['channel'] < 15) {
831
				$input_errors[] = gettext("Channel selected is not valid for 802.11a or 802.11na.");
832
			}
833
		}
834 aec55f9a Chris Buechler
		if (isset($_POST['standard']) && ($_POST['standard'] == "11b" || $_POST['standard'] == "11g")) {
835 6cd14b43 Chris Buechler
			if ($_POST['channel'] > 14) {
836
				$input_errors[] = gettext("Channel selected is not valid for 802.11b or 802.11g.");
837
			}
838
		}
839 aec55f9a Chris Buechler
		if (!empty($_POST['protmode']) && !in_array($_POST['protmode'], array("off", "cts", "rtscts"))) {
840
			$input_errors[] = gettext("Invalid option chosen for OFDM Protection Mode");
841
		}
842 53c82ef9 Scott Ullrich
		/* loop through keys and enforce size */
843
		for ($i = 1; $i <= 4; $i++) {
844
			if ($_POST['key' . $i]) {
845
				/* 64 bit */
846
				if (strlen($_POST['key' . $i]) == 5)
847
					continue;
848
				if (strlen($_POST['key' . $i]) == 10) {
849
					/* hex key */
850
					if (stristr($_POST['key' . $i], "0x") == false) {
851 4634cb48 Ermal Luçi
						$_POST['key' . $i] = "0x" . $_POST['key' . $i];
852
					}
853 53c82ef9 Scott Ullrich
					continue;
854
				}
855
				if (strlen($_POST['key' . $i]) == 12) {
856
					/* hex key */
857
					if(stristr($_POST['key' . $i], "0x") == false) {
858
					$_POST['key' . $i] = "0x" . $_POST['key' . $i];
859 4634cb48 Ermal Luçi
					}
860 53c82ef9 Scott Ullrich
					continue;
861
				}
862
				/* 128 bit */
863
				if (strlen($_POST['key' . $i]) == 13)
864
					continue;
865
				if (strlen($_POST['key' . $i]) == 26) {
866
					/* hex key */
867
					if (stristr($_POST['key' . $i], "0x") == false)
868
						$_POST['key' . $i] = "0x" . $_POST['key' . $i];
869
					continue;
870 4634cb48 Ermal Luçi
				}
871 53c82ef9 Scott Ullrich
				if(strlen($_POST['key' . $i]) == 28)
872
					continue;
873 4958ca9e Chris Buechler
				$input_errors[] =  gettext("Invalid WEP key. Enter a valid 40, 64, 104 or 128 bit WEP key.");
874 53c82ef9 Scott Ullrich
				break;
875 4634cb48 Ermal Luçi
			}
876 5b237745 Scott Ullrich
		}
877 08fae438 Ermal Lu?i
878
		if ($_POST['passphrase']) {
879 6d529efd Renato Botelho
			$passlen = strlen($_POST['passphrase']);
880 df78d8cc Renato Botelho
			if ($passlen < 8 || $passlen > 63)
881 310ea4e2 Chris Buechler
				$input_errors[] = gettext("The WPA passphrase must be between 8 and 63 characters long.");
882
		}
883
		if ($_POST['wpa_enable'] == "yes") {
884
			if (empty($_POST['passphrase']) && stristr($_POST['wpa_key_mgmt'], "WPA-PSK")) {
885
				$input_errors[] = gettext("A WPA Passphrase must be specified when WPA PSK is enabled.");
886
			}
887 08fae438 Ermal Lu?i
		}
888 53c82ef9 Scott Ullrich
	}
889
	if (!$input_errors) {
890 8b1e7d04 Ermal
		if ($wancfg['ipaddr'] != $_POST['type']) {
891 ef130e9f Ermal
			if (in_array($wancfg['ipaddr'], array("ppp", "pppoe", "pptp", "l2tp"))) {
892
				$wancfg['if'] = $a_ppps[$pppid]['ports'];
893
				unset($a_ppps[$pppid]);
894 8b1e7d04 Ermal
			} else if ($wancfg['ipaddr'] == "dhcp") {
895 d9d1bd20 Renato Botelho
				kill_dhclient_process($wancfg['if']);
896 ef130e9f Ermal
			}
897 89c7a9c8 Ermal
			if ($wancfg['ipaddrv6'] == "dhcp6") {
898
				$pid = find_dhcp6c_process($wancfg['if']);
899
				if($pid)
900
					posix_kill($pid, SIGTERM);
901
			}
902 ef130e9f Ermal
		}
903 d85ba87f gnhb
		$ppp = array();
904 da75413d Ermal
		if ($wancfg['ipaddr'] != "ppp")
905
			unset($wancfg['ipaddr']);
906 47593ac6 Seth Mos
		if ($wancfg['ipaddrv6'] != "ppp")
907
			unset($wancfg['ipaddrv6']);
908 53c82ef9 Scott Ullrich
		unset($wancfg['subnet']);
909
		unset($wancfg['gateway']);
910 47593ac6 Seth Mos
		unset($wancfg['subnetv6']);
911
		unset($wancfg['gatewayv6']);
912 53c82ef9 Scott Ullrich
		unset($wancfg['dhcphostname']);
913 57c83fd6 jim-p
		unset($wancfg['dhcprejectfrom']);
914 ed395640 Seth Mos
		unset($wancfg['dhcp6-duid']);
915
		unset($wancfg['dhcp6-ia-pd-len']);
916 18f3c2fd Daniel Becker
		unset($wancfg['dhcp6-ia-pd-send-hint']);
917 a13acc0e smos
		unset($wancfg['dhcp6prefixonly']);
918 dbb4e089 Ermal
		unset($wancfg['dhcp6usev4iface']);
919 20a7cb15 smos
		unset($wancfg['track6-interface']);
920 6d529efd Renato Botelho
		unset($wancfg['track6-prefix-id']);
921 7d567088 smos
		unset($wancfg['prefix-6rd']);
922 12215bfb smos
		unset($wancfg['prefix-6rd-v4plen']);
923 7d567088 smos
		unset($wancfg['gateway-6rd']);
924 f4dd8b4c N0YB
925
		unset($wancfg['adv_dhcp_pt_timeout']);
926
		unset($wancfg['adv_dhcp_pt_retry']);
927
		unset($wancfg['adv_dhcp_pt_select_timeout']);
928
		unset($wancfg['adv_dhcp_pt_reboot']);
929
		unset($wancfg['adv_dhcp_pt_backoff_cutoff']);
930
		unset($wancfg['adv_dhcp_pt_initial_interval']);
931
932
		unset($wancfg['adv_dhcp_pt_values']);
933
934
		unset($wancfg['adv_dhcp_send_options']);
935
		unset($wancfg['adv_dhcp_request_options']);
936
		unset($wancfg['adv_dhcp_required_options']);
937
		unset($wancfg['adv_dhcp_option_modifiers']);
938
939
		unset($wancfg['adv_dhcp_config_advanced']);
940
		unset($wancfg['adv_dhcp_config_file_override']);
941
		unset($wancfg['adv_dhcp_config_file_override_path']);
942
943
		unset($wancfg['adv_dhcp6_interface_statement_send_options']);
944
		unset($wancfg['adv_dhcp6_interface_statement_request_options']);
945
		unset($wancfg['adv_dhcp6_interface_statement_information_only_enable']);
946
		unset($wancfg['adv_dhcp6_interface_statement_script']);
947
948
		unset($wancfg['adv_dhcp6_id_assoc_statement_address_enable']);
949
		unset($wancfg['adv_dhcp6_id_assoc_statement_address']);
950
		unset($wancfg['adv_dhcp6_id_assoc_statement_address_id']);
951
		unset($wancfg['adv_dhcp6_id_assoc_statement_address_pltime']);
952
		unset($wancfg['adv_dhcp6_id_assoc_statement_address_vltime']);
953
954
		unset($wancfg['adv_dhcp6_id_assoc_statement_prefix_enable']);
955
		unset($wancfg['adv_dhcp6_id_assoc_statement_prefix']);
956
		unset($wancfg['adv_dhcp6_id_assoc_statement_prefix_id']);
957
		unset($wancfg['adv_dhcp6_id_assoc_statement_prefix_pltime']);
958
		unset($wancfg['adv_dhcp6_id_assoc_statement_prefix_vltime']);
959
960
		unset($wancfg['adv_dhcp6_prefix_interface_statement_sla_id']);
961
		unset($wancfg['adv_dhcp6_prefix_interface_statement_sla_len']);
962
963
		unset($wancfg['adv_dhcp6_authentication_statement_authname']);
964
		unset($wancfg['adv_dhcp6_authentication_statement_protocol']);
965
		unset($wancfg['adv_dhcp6_authentication_statement_algorithm']);
966
		unset($wancfg['adv_dhcp6_authentication_statement_rdm']);
967
968
		unset($wancfg['adv_dhcp6_key_info_statement_keyname']);
969
		unset($wancfg['adv_dhcp6_key_info_statement_realm']);
970
		unset($wancfg['adv_dhcp6_key_info_statement_keyid']);
971
		unset($wancfg['adv_dhcp6_key_info_statement_secret']);
972
		unset($wancfg['adv_dhcp6_key_info_statement_expire']);
973
974
		unset($wancfg['adv_dhcp6_config_advanced']);
975
		unset($wancfg['adv_dhcp6_config_file_override']);
976
		unset($wancfg['adv_dhcp6_config_file_override_path']);
977
978 53c82ef9 Scott Ullrich
		unset($wancfg['pppoe_password']);
979
		unset($wancfg['pptp_username']);
980
		unset($wancfg['pptp_password']);
981
		unset($wancfg['provider']);
982 c4642eb1 Ermal LUÇI
		unset($wancfg['ondemand']);
983 53c82ef9 Scott Ullrich
		unset($wancfg['timeout']);
984 70e46e62 Ermal
		if (empty($wancfg['pppoe']['pppoe-reset-type']))
985 8b7ae9a3 jim-p
			unset($wancfg['pppoe']['pppoe-reset-type']);
986 53c82ef9 Scott Ullrich
		unset($wancfg['local']);
987 6d529efd Renato Botelho
988 53c82ef9 Scott Ullrich
		unset($wancfg['remote']);
989 c4642eb1 Ermal LUÇI
		if (is_array($a_ppps[$pppid]) && in_array($wancfg['ipaddr'], array("ppp", "pppoe", "pptp", "l2tp"))) {
990
			if ($wancfg['ipaddr'] != 'ppp') {
991
				unset($a_ppps[$pppid]['apn']);
992
				unset($a_ppps[$pppid]['phone']);
993
				unset($a_ppps[$pppid]['provider']);
994 e840fc8c Chris Buechler
				unset($a_ppps[$pppid]['ondemand']);
995 c4642eb1 Ermal LUÇI
			}
996 e840fc8c Chris Buechler
			if (in_array($wancfg['ipaddr'], array("pppoe", "pptp", "l2tp"))) {
997 c4642eb1 Ermal LUÇI
				unset($a_ppps[$pppid]['localip']);
998
				unset($a_ppps[$pppid]['subnet']);
999
				unset($a_ppps[$pppid]['gateway']);
1000
			}
1001
			if ($wancfg['ipaddr'] != 'pppoe')
1002
				unset($a_ppps[$pppid]['pppoe-reset-type']);
1003
			if ($wancfg['type'] != $_POST['type']) {
1004
				unset($a_ppps[$pppid]['idletimeout']);
1005
			}
1006
		}
1007 c0948c6c Renato Botelho
1008 53c82ef9 Scott Ullrich
		$wancfg['descr'] = remove_bad_chars($_POST['descr']);
1009 6a688547 Ermal
		$wancfg['enable'] =  $_POST['enable']  == "yes" ? true : false;
1010 9ff9a1c7 Seth Mos
1011 2fe06a32 smos
		/* let return_gateways_array() do the magic on dynamic interfaces for us */
1012 9ff9a1c7 Seth Mos
		switch($_POST['type']) {
1013 47593ac6 Seth Mos
			case "staticv4":
1014
				$wancfg['ipaddr'] = $_POST['ipaddr'];
1015
				$wancfg['subnet'] = $_POST['subnet'];
1016
				if ($_POST['gateway'] != "none") {
1017
					$wancfg['gateway'] = $_POST['gateway'];
1018
				}
1019
				break;
1020 9ff9a1c7 Seth Mos
			case "dhcp":
1021
				$wancfg['ipaddr'] = "dhcp";
1022
				$wancfg['dhcphostname'] = $_POST['dhcphostname'];
1023
				$wancfg['alias-address'] = $_POST['alias-address'];
1024
				$wancfg['alias-subnet'] = $_POST['alias-subnet'];
1025 57c83fd6 jim-p
				$wancfg['dhcprejectfrom'] = $_POST['dhcprejectfrom'];
1026 f4dd8b4c N0YB
1027
				$wancfg['adv_dhcp_pt_timeout'] = $_POST['adv_dhcp_pt_timeout'];
1028
				$wancfg['adv_dhcp_pt_retry'] = $_POST['adv_dhcp_pt_retry'];
1029
				$wancfg['adv_dhcp_pt_select_timeout'] = $_POST['adv_dhcp_pt_select_timeout'];
1030
				$wancfg['adv_dhcp_pt_reboot'] = $_POST['adv_dhcp_pt_reboot'];
1031
				$wancfg['adv_dhcp_pt_backoff_cutoff'] = $_POST['adv_dhcp_pt_backoff_cutoff'];
1032
				$wancfg['adv_dhcp_pt_initial_interval'] = $_POST['adv_dhcp_pt_initial_interval'];
1033
1034
				$wancfg['adv_dhcp_pt_values'] = $_POST['adv_dhcp_pt_values'];
1035
1036
				$wancfg['adv_dhcp_send_options'] = $_POST['adv_dhcp_send_options'];
1037
				$wancfg['adv_dhcp_request_options'] = $_POST['adv_dhcp_request_options'];
1038
				$wancfg['adv_dhcp_required_options'] = $_POST['adv_dhcp_required_options'];
1039
				$wancfg['adv_dhcp_option_modifiers'] = $_POST['adv_dhcp_option_modifiers'];
1040
1041
				$wancfg['adv_dhcp_config_advanced'] = $_POST['adv_dhcp_config_advanced'];
1042
				$wancfg['adv_dhcp_config_file_override'] = $_POST['adv_dhcp_config_file_override'];
1043
				$wancfg['adv_dhcp_config_file_override_path'] = $_POST['adv_dhcp_config_file_override_path'];
1044
1045 e4d40f41 gnhb
				$wancfg['dhcp_plus'] = $_POST['dhcp_plus'] == "yes" ? true : false;
1046 9ff9a1c7 Seth Mos
				if($gateway_item) {
1047
					$a_gateways[] = $gateway_item;
1048
				}
1049
				break;
1050 3a906378 gnhb
			case "ppp":
1051
				$a_ppps[$pppid]['ptpid'] = $_POST['ptpid'];
1052
				$a_ppps[$pppid]['type'] = $_POST['type'];
1053 1d7e1d6c gnhb
				$a_ppps[$pppid]['if'] = $_POST['type'].$_POST['ptpid'];
1054 3a906378 gnhb
				$a_ppps[$pppid]['ports'] = $_POST['port'];
1055 67877234 Phil Davis
				$a_ppps[$pppid]['username'] = $_POST['ppp_username'];
1056
				$a_ppps[$pppid]['password'] = base64_encode($_POST['ppp_password']);
1057 8256f324 gnhb
				$a_ppps[$pppid]['phone'] = $_POST['phone'];
1058 3a906378 gnhb
				$a_ppps[$pppid]['apn'] = $_POST['apn'];
1059 1d7e1d6c gnhb
				$wancfg['if'] = $_POST['type'] . $_POST['ptpid'];
1060 8256f324 gnhb
				$wancfg['ipaddr'] = $_POST['type'];
1061 3a906378 gnhb
				break;
1062
1063 9ff9a1c7 Seth Mos
			case "pppoe":
1064 6c05cfb0 gnhb
				$a_ppps[$pppid]['ptpid'] = $_POST['ptpid'];
1065
				$a_ppps[$pppid]['type'] = $_POST['type'];
1066 1d7e1d6c gnhb
				$a_ppps[$pppid]['if'] = $_POST['type'].$_POST['ptpid'];
1067 d85ba87f gnhb
				if (isset($_POST['ppp_port']))
1068 6c05cfb0 gnhb
					$a_ppps[$pppid]['ports'] = $_POST['ppp_port'];
1069 d85ba87f gnhb
				else
1070 6c05cfb0 gnhb
					$a_ppps[$pppid]['ports'] = $wancfg['if'];
1071
				$a_ppps[$pppid]['username'] = $_POST['pppoe_username'];
1072
				$a_ppps[$pppid]['password'] = base64_encode($_POST['pppoe_password']);
1073 d85ba87f gnhb
				if (!empty($_POST['provider']))
1074 6c05cfb0 gnhb
					$a_ppps[$pppid]['provider'] = $_POST['provider'];
1075 d85ba87f gnhb
				else
1076 233e2af1 jim-p
					$a_ppps[$pppid]['provider'] = true;
1077 6c05cfb0 gnhb
				$a_ppps[$pppid]['ondemand'] = $_POST['pppoe_dialondemand'] ? true : false;
1078 0ff214f2 Renato Botelho
				if (!empty($_POST['pppoe_idletimeout']))
1079 6c05cfb0 gnhb
					$a_ppps[$pppid]['idletimeout'] = $_POST['pppoe_idletimeout'];
1080 d85ba87f gnhb
				else
1081 6c05cfb0 gnhb
					unset($a_ppps[$pppid]['idletimeout']);
1082 d85ba87f gnhb
1083
				if (!empty($_POST['pppoe-reset-type']))
1084 6c05cfb0 gnhb
					$a_ppps[$pppid]['pppoe-reset-type'] = $_POST['pppoe-reset-type'];
1085 d85ba87f gnhb
				else
1086 6c05cfb0 gnhb
					unset($a_ppps[$pppid]['pppoe-reset-type']);
1087 1d7e1d6c gnhb
				$wancfg['if'] = $_POST['type'].$_POST['ptpid'];
1088 d85ba87f gnhb
				$wancfg['ipaddr'] = $_POST['type'];
1089 9ff9a1c7 Seth Mos
				if($gateway_item) {
1090
					$a_gateways[] = $gateway_item;
1091
				}
1092 c0948c6c Renato Botelho
1093 9ff9a1c7 Seth Mos
				break;
1094
			case "pptp":
1095 e4d40f41 gnhb
			case "l2tp":
1096 6c05cfb0 gnhb
				$a_ppps[$pppid]['ptpid'] = $_POST['ptpid'];
1097
				$a_ppps[$pppid]['type'] = $_POST['type'];
1098 1d7e1d6c gnhb
				$a_ppps[$pppid]['if'] = $_POST['type'].$_POST['ptpid'];
1099 d85ba87f gnhb
				if (isset($_POST['ppp_port']))
1100 6c05cfb0 gnhb
					$a_ppps[$pppid]['ports'] = $_POST['ppp_port'];
1101 d85ba87f gnhb
				else
1102 6c05cfb0 gnhb
					$a_ppps[$pppid]['ports'] = $wancfg['if'];
1103
				$a_ppps[$pppid]['username'] = $_POST['pptp_username'];
1104
				$a_ppps[$pppid]['password'] = base64_encode($_POST['pptp_password']);
1105 ced4df74 gnhb
				$a_ppps[$pppid]['localip'] = $_POST['pptp_local'];
1106 6c05cfb0 gnhb
				$a_ppps[$pppid]['subnet'] = $_POST['pptp_subnet'];
1107
				$a_ppps[$pppid]['gateway'] = $_POST['pptp_remote'];
1108
				$a_ppps[$pppid]['ondemand'] = $_POST['pptp_dialondemand'] ? true : false;
1109 0ff214f2 Renato Botelho
				if (!empty($_POST['pptp_idletimeout']))
1110 6c05cfb0 gnhb
					$a_ppps[$pppid]['idletimeout'] = $_POST['pptp_idletimeout'];
1111 d85ba87f gnhb
				else
1112 6c05cfb0 gnhb
					unset($a_ppps[$pppid]['idletimeout']);
1113 1d7e1d6c gnhb
				$wancfg['if'] = $_POST['type'].$_POST['ptpid'];
1114 d85ba87f gnhb
				$wancfg['ipaddr'] = $_POST['type'];
1115 9ff9a1c7 Seth Mos
				if($gateway_item) {
1116
					$a_gateways[] = $gateway_item;
1117
				}
1118
				break;
1119 6c05cfb0 gnhb
			case "none":
1120
				break;
1121 4634cb48 Ermal Luçi
		}
1122 e029943a Seth Mos
		switch($_POST['type6']) {
1123
			case "staticv6":
1124
				$wancfg['ipaddrv6'] = $_POST['ipaddrv6'];
1125
				$wancfg['subnetv6'] = $_POST['subnetv6'];
1126
				if ($_POST['gatewayv6'] != "none") {
1127
					$wancfg['gatewayv6'] = $_POST['gatewayv6'];
1128
				}
1129
				break;
1130 feb88a14 smos
			case "slaac":
1131
				$wancfg['ipaddrv6'] = "slaac";
1132
				break;
1133 e029943a Seth Mos
			case "dhcp6":
1134
				$wancfg['ipaddrv6'] = "dhcp6";
1135
				$wancfg['dhcp6-duid'] = $_POST['dhcp6-duid'];
1136
				$wancfg['dhcp6-ia-pd-len'] = $_POST['dhcp6-ia-pd-len'];
1137 18f3c2fd Daniel Becker
				if($_POST['dhcp6-ia-pd-send-hint'] == "yes")
1138
					$wancfg['dhcp6-ia-pd-send-hint'] = true;
1139 a13acc0e smos
				if($_POST['dhcp6prefixonly'] == "yes")
1140
					$wancfg['dhcp6prefixonly'] = true;
1141 dbb4e089 Ermal
				if($_POST['dhcp6usev4iface'] == "yes")
1142
					$wancfg['dhcp6usev4iface'] = true;
1143 f4dd8b4c N0YB
1144 110967a4 Ermal LUÇI
				if (!empty($_POST['adv_dhcp6_interface_statement_send_options']))
1145
					$wancfg['adv_dhcp6_interface_statement_send_options'] = $_POST['adv_dhcp6_interface_statement_send_options'];
1146
				if (!empty($_POST['adv_dhcp6_interface_statement_request_options']))
1147
					$wancfg['adv_dhcp6_interface_statement_request_options'] = $_POST['adv_dhcp6_interface_statement_request_options'];
1148
				if (isset($_POST['adv_dhcp6_interface_statement_information_only_enable']))
1149
					$wancfg['adv_dhcp6_interface_statement_information_only_enable'] = $_POST['adv_dhcp6_interface_statement_information_only_enable'];
1150
				if (!empty($_POST['adv_dhcp6_interface_statement_script']))
1151
					$wancfg['adv_dhcp6_interface_statement_script'] = $_POST['adv_dhcp6_interface_statement_script'];
1152
1153
				if (isset($_POST['adv_dhcp6_id_assoc_statement_address_enable']))
1154
					$wancfg['adv_dhcp6_id_assoc_statement_address_enable'] = $_POST['adv_dhcp6_id_assoc_statement_address_enable'];
1155
				if (!empty($_POST['adv_dhcp6_id_assoc_statement_address']))
1156
					$wancfg['adv_dhcp6_id_assoc_statement_address'] = $_POST['adv_dhcp6_id_assoc_statement_address'];
1157
				if (!empty($_POST['adv_dhcp6_id_assoc_statement_address_id']))
1158
					$wancfg['adv_dhcp6_id_assoc_statement_address_id'] = $_POST['adv_dhcp6_id_assoc_statement_address_id'];
1159
				if (!empty($_POST['adv_dhcp6_id_assoc_statement_address_pltime']))
1160
					$wancfg['adv_dhcp6_id_assoc_statement_address_pltime'] = $_POST['adv_dhcp6_id_assoc_statement_address_pltime'];
1161
				if (!empty($_POST['adv_dhcp6_id_assoc_statement_address_vltime']))
1162
					$wancfg['adv_dhcp6_id_assoc_statement_address_vltime'] = $_POST['adv_dhcp6_id_assoc_statement_address_vltime'];
1163
1164
				if (isset($_POST['adv_dhcp6_id_assoc_statement_prefix_enable']))
1165
					$wancfg['adv_dhcp6_id_assoc_statement_prefix_enable'] = $_POST['adv_dhcp6_id_assoc_statement_prefix_enable'];
1166
				if (!empty($_POST['adv_dhcp6_id_assoc_statement_prefix']))
1167
					$wancfg['adv_dhcp6_id_assoc_statement_prefix'] = $_POST['adv_dhcp6_id_assoc_statement_prefix'];
1168
				if (!empty($_POST['adv_dhcp6_id_assoc_statement_prefix_id']))
1169
					$wancfg['adv_dhcp6_id_assoc_statement_prefix_id'] = $_POST['adv_dhcp6_id_assoc_statement_prefix_id'];
1170
				if (!empty($_POST['adv_dhcp6_id_assoc_statement_prefix_pltime']))
1171
					$wancfg['adv_dhcp6_id_assoc_statement_prefix_pltime'] = $_POST['adv_dhcp6_id_assoc_statement_prefix_pltime'];
1172
				if (!empty($_POST['adv_dhcp6_id_assoc_statement_prefix_vltime']))
1173
					$wancfg['adv_dhcp6_id_assoc_statement_prefix_vltime'] = $_POST['adv_dhcp6_id_assoc_statement_prefix_vltime'];
1174
1175
				if (!empty($_POST['adv_dhcp6_prefix_interface_statement_sla_id']))
1176
					$wancfg['adv_dhcp6_prefix_interface_statement_sla_id'] = $_POST['adv_dhcp6_prefix_interface_statement_sla_id'];
1177
				if (!empty($_POST['adv_dhcp6_prefix_interface_statement_sla_len']))
1178
					$wancfg['adv_dhcp6_prefix_interface_statement_sla_len'] = $_POST['adv_dhcp6_prefix_interface_statement_sla_len'];
1179
1180
				if (!empty($_POST['adv_dhcp6_authentication_statement_authname']))
1181
					$wancfg['adv_dhcp6_authentication_statement_authname'] = $_POST['adv_dhcp6_authentication_statement_authname'];
1182
				if (!empty($_POST['adv_dhcp6_authentication_statement_protocol']))
1183
					$wancfg['adv_dhcp6_authentication_statement_protocol'] = $_POST['adv_dhcp6_authentication_statement_protocol'];
1184
				if (!empty($_POST['adv_dhcp6_authentication_statement_algorithm']))
1185
					$wancfg['adv_dhcp6_authentication_statement_algorithm'] = $_POST['adv_dhcp6_authentication_statement_algorithm'];
1186
				if (!empty($_POST['adv_dhcp6_authentication_statement_rdm']))
1187
					$wancfg['adv_dhcp6_authentication_statement_rdm'] = $_POST['adv_dhcp6_authentication_statement_rdm'];
1188
1189
				if (!empty($_POST['adv_dhcp6_key_info_statement_keyname']))
1190
					$wancfg['adv_dhcp6_key_info_statement_keyname'] = $_POST['adv_dhcp6_key_info_statement_keyname'];
1191
				if (!empty($_POST['adv_dhcp6_key_info_statement_realm']))
1192
					$wancfg['adv_dhcp6_key_info_statement_realm'] = $_POST['adv_dhcp6_key_info_statement_realm'];
1193
				if (!empty($_POST['adv_dhcp6_key_info_statement_keyid']))
1194
					$wancfg['adv_dhcp6_key_info_statement_keyid'] = $_POST['adv_dhcp6_key_info_statement_keyid'];
1195
				if (!empty($_POST['adv_dhcp6_key_info_statement_secret']))
1196
					$wancfg['adv_dhcp6_key_info_statement_secret'] = $_POST['adv_dhcp6_key_info_statement_secret'];
1197
				if (!empty($_POST['adv_dhcp6_key_info_statement_expire']))
1198
					$wancfg['adv_dhcp6_key_info_statement_expire'] = $_POST['adv_dhcp6_key_info_statement_expire'];
1199
1200
				if (!empty($_POST['adv_dhcp6_config_advanced']))
1201
					$wancfg['adv_dhcp6_config_advanced'] = $_POST['adv_dhcp6_config_advanced'];
1202
				if (!empty($_POST['adv_dhcp6_config_file_override']))
1203
					$wancfg['adv_dhcp6_config_file_override'] = $_POST['adv_dhcp6_config_file_override'];
1204
				if (!empty($_POST['adv_dhcp6_config_file_override_path']))
1205
					$wancfg['adv_dhcp6_config_file_override_path'] = $_POST['adv_dhcp6_config_file_override_path'];
1206 f4dd8b4c N0YB
1207 e029943a Seth Mos
				if($gateway_item) {
1208
					$a_gateways[] = $gateway_item;
1209
				}
1210
				break;
1211 7d567088 smos
			case "6rd":
1212
				$wancfg['ipaddrv6'] = "6rd";
1213
				$wancfg['prefix-6rd'] = $_POST['prefix-6rd'];
1214 12215bfb smos
				$wancfg['prefix-6rd-v4plen'] = $_POST['prefix-6rd-v4plen'];
1215 7d567088 smos
				$wancfg['gateway-6rd'] = $_POST['gateway-6rd'];
1216
				if($gateway_item) {
1217
					$a_gateways[] = $gateway_item;
1218
				}
1219
				break;
1220 31c43fd3 smos
			case "6to4":
1221
				$wancfg['ipaddrv6'] = "6to4";
1222
				break;
1223 20a7cb15 smos
			case "track6":
1224
				$wancfg['ipaddrv6'] = "track6";
1225
				$wancfg['track6-interface'] = $_POST['track6-interface'];
1226 02203e6d Renato Botelho
				if ($_POST['track6-prefix-id--hex'] === "")
1227
					$wancfg['track6-prefix-id'] = 0;
1228
				else if (is_numeric("0x" . $_POST['track6-prefix-id--hex']))
1229 6b2d4b5a Darren Embry
					$wancfg['track6-prefix-id'] = intval($_POST['track6-prefix-id--hex'], 16);
1230 02203e6d Renato Botelho
				else
1231
					$wancfg['track6-prefix-id'] = 0;
1232 20a7cb15 smos
				break;
1233 e029943a Seth Mos
			case "none":
1234
				break;
1235
		}
1236 1d7e1d6c gnhb
		handle_pppoe_reset($_POST);
1237 c0948c6c Renato Botelho
1238 9ff9a1c7 Seth Mos
		if($_POST['blockpriv'] == "yes") {
1239 53c82ef9 Scott Ullrich
			$wancfg['blockpriv'] = true;
1240 9ff9a1c7 Seth Mos
		} else {
1241 53c82ef9 Scott Ullrich
			unset($wancfg['blockpriv']);
1242 9ff9a1c7 Seth Mos
		}
1243
		if($_POST['blockbogons'] == "yes") {
1244 53c82ef9 Scott Ullrich
			$wancfg['blockbogons'] = true;
1245 9ff9a1c7 Seth Mos
		} else {
1246 53c82ef9 Scott Ullrich
			unset($wancfg['blockbogons']);
1247 9ff9a1c7 Seth Mos
		}
1248 53c82ef9 Scott Ullrich
		$wancfg['spoofmac'] = $_POST['spoofmac'];
1249 9ff9a1c7 Seth Mos
		if (empty($_POST['mtu'])) {
1250 d6a891da Ermal Lu?i
			unset($wancfg['mtu']);
1251 9ff9a1c7 Seth Mos
		} else {
1252 d6a891da Ermal Lu?i
			$wancfg['mtu'] = $_POST['mtu'];
1253 9ff9a1c7 Seth Mos
		}
1254 4cea5cf8 Ermal
		if (empty($_POST['mss'])) {
1255
			unset($wancfg['mss']);
1256
		} else {
1257
			$wancfg['mss'] = $_POST['mss'];
1258
		}
1259 509ca889 Evgeny Yurchenko
		if (empty($_POST['mediaopt'])) {
1260
			unset($wancfg['media']);
1261
			unset($wancfg['mediaopt']);
1262
		} else {
1263 6d529efd Renato Botelho
			$mediaopts = explode(' ', $_POST['mediaopt']);
1264 509ca889 Evgeny Yurchenko
			if ($mediaopts[0] != ''){ $wancfg['media'] = $mediaopts[0]; }
1265
			if ($mediaopts[1] != ''){ $wancfg['mediaopt'] = $mediaopts[1]; }
1266
			else { unset($wancfg['mediaopt']); }
1267
		}
1268 9ff9a1c7 Seth Mos
		if (isset($wancfg['wireless'])) {
1269 25a6411a Scott Ullrich
			handle_wireless_post();
1270 9ff9a1c7 Seth Mos
		}
1271 c0948c6c Renato Botelho
1272 dd18038e Ermal
		conf_mount_ro();
1273 53c82ef9 Scott Ullrich
		write_config();
1274 dd18038e Ermal
1275 ee5c01b5 Seth Mos
		if (file_exists("{$g['tmp_path']}/.interfaces.apply")) {
1276 dd18038e Ermal
			$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.interfaces.apply"));
1277 ee5c01b5 Seth Mos
		} else {
1278 dd18038e Ermal
			$toapplylist = array();
1279 ee5c01b5 Seth Mos
		}
1280 e12ad49f Renato Botelho
		$toapplylist[$if]['ifcfg'] = $old_wancfg;
1281
		$toapplylist[$if]['ppps'] = $old_ppps;
1282 dd18038e Ermal
		file_put_contents("{$g['tmp_path']}/.interfaces.apply", serialize($toapplylist));
1283
1284 a368a026 Ermal Lu?i
		mark_subsystem_dirty('interfaces');
1285 dd18038e Ermal
1286 53c82ef9 Scott Ullrich
		/* regenerate cron settings/crontab file */
1287
		configure_cron();
1288 dd18038e Ermal
1289 53c82ef9 Scott Ullrich
		header("Location: interfaces.php?if={$if}");
1290
		exit;
1291
	}
1292 c0948c6c Renato Botelho
1293
} // end if($_POST)
1294 270c4607 Scott Ullrich
1295 25a6411a Scott Ullrich
function handle_wireless_post() {
1296 f62c44d8 Erik Fonnesbeck
	global $_POST, $config, $g, $wancfg, $if, $wl_countries_attr, $wlanbaseif;
1297 270c4607 Scott Ullrich
	if (!is_array($wancfg['wireless']))
1298
		$wancfg['wireless'] = array();
1299
	$wancfg['wireless']['standard'] = $_POST['standard'];
1300
	$wancfg['wireless']['mode'] = $_POST['mode'];
1301
	$wancfg['wireless']['protmode'] = $_POST['protmode'];
1302
	$wancfg['wireless']['ssid'] = $_POST['ssid'];
1303
	$wancfg['wireless']['channel'] = $_POST['channel'];
1304
	$wancfg['wireless']['authmode'] = $_POST['authmode'];
1305
	$wancfg['wireless']['txpower'] = $_POST['txpower'];
1306
	$wancfg['wireless']['distance'] = $_POST['distance'];
1307 20f09b3b Erik Fonnesbeck
	$wancfg['wireless']['regdomain'] = $_POST['regdomain'];
1308
	$wancfg['wireless']['regcountry'] = $_POST['regcountry'];
1309
	$wancfg['wireless']['reglocation'] = $_POST['reglocation'];
1310
	if (!empty($wancfg['wireless']['regdomain']) && !empty($wancfg['wireless']['regcountry'])) {
1311 071d63b9 Erik Fonnesbeck
		foreach($wl_countries_attr as $wl_country) {
1312
			if ($wancfg['wireless']['regcountry'] == $wl_country['ID']) {
1313
				$wancfg['wireless']['regdomain'] = $wl_country['rd'][0]['REF'];
1314 20f09b3b Erik Fonnesbeck
				break;
1315
			}
1316
		}
1317
	}
1318 270c4607 Scott Ullrich
	if (!is_array($wancfg['wireless']['wpa']))
1319
		$wancfg['wireless']['wpa'] = array();
1320
	$wancfg['wireless']['wpa']['macaddr_acl'] = $_POST['macaddr_acl'];
1321
	$wancfg['wireless']['wpa']['auth_algs'] = $_POST['auth_algs'];
1322
	$wancfg['wireless']['wpa']['wpa_mode'] = $_POST['wpa_mode'];
1323
	$wancfg['wireless']['wpa']['wpa_key_mgmt'] = $_POST['wpa_key_mgmt'];
1324
	$wancfg['wireless']['wpa']['wpa_pairwise'] = $_POST['wpa_pairwise'];
1325
	$wancfg['wireless']['wpa']['wpa_group_rekey'] = $_POST['wpa_group_rekey'];
1326
	$wancfg['wireless']['wpa']['wpa_gmk_rekey'] = $_POST['wpa_gmk_rekey'];
1327
	$wancfg['wireless']['wpa']['passphrase'] = $_POST['passphrase'];
1328
	$wancfg['wireless']['wpa']['ext_wpa_sw'] = $_POST['ext_wpa_sw'];
1329 5949124c Scott Ullrich
	$wancfg['wireless']['auth_server_addr'] = $_POST['auth_server_addr'];
1330
	$wancfg['wireless']['auth_server_port'] = $_POST['auth_server_port'];
1331
	$wancfg['wireless']['auth_server_shared_secret'] = $_POST['auth_server_shared_secret'];
1332 32764288 Namezero
	$wancfg['wireless']['auth_server_addr2'] = $_POST['auth_server_addr2'];
1333
	$wancfg['wireless']['auth_server_port2'] = $_POST['auth_server_port2'];
1334
	$wancfg['wireless']['auth_server_shared_secret2'] = $_POST['auth_server_shared_secret2'];
1335 6d529efd Renato Botelho
1336 f62c44d8 Erik Fonnesbeck
	if ($_POST['persistcommonwireless'] == "yes") {
1337 6ef2297b Erik Fonnesbeck
		if (!is_array($config['wireless']))
1338
			$config['wireless'] = array();
1339
		if (!is_array($config['wireless']['interfaces']))
1340
			$config['wireless']['interfaces'] = array();
1341
		if (!is_array($config['wireless']['interfaces'][$wlanbaseif]))
1342 f62c44d8 Erik Fonnesbeck
			$config['wireless']['interfaces'][$wlanbaseif] = array();
1343
	} else if (isset($config['wireless']['interfaces'][$wlanbaseif]))
1344
		unset($config['wireless']['interfaces'][$wlanbaseif]);
1345 1930ccb6 Erik Fonnesbeck
	if (isset($_POST['diversity']) && is_numeric($_POST['diversity']))
1346 537bf7b3 Erik Fonnesbeck
		$wancfg['wireless']['diversity'] = $_POST['diversity'];
1347
	else if (isset($wancfg['wireless']['diversity']))
1348
		unset($wancfg['wireless']['diversity']);
1349 1930ccb6 Erik Fonnesbeck
	if (isset($_POST['txantenna']) && is_numeric($_POST['txantenna']))
1350 537bf7b3 Erik Fonnesbeck
		$wancfg['wireless']['txantenna'] = $_POST['txantenna'];
1351
	else if (isset($wancfg['wireless']['txantenna']))
1352
		unset($wancfg['wireless']['txantenna']);
1353 1930ccb6 Erik Fonnesbeck
	if (isset($_POST['rxantenna']) && is_numeric($_POST['rxantenna']))
1354 537bf7b3 Erik Fonnesbeck
		$wancfg['wireless']['rxantenna'] = $_POST['rxantenna'];
1355
	else if (isset($wancfg['wireless']['rxantenna']))
1356
		unset($wancfg['wireless']['rxantenna']);
1357 270c4607 Scott Ullrich
	if ($_POST['hidessid_enable'] == "yes")
1358
		$wancfg['wireless']['hidessid']['enable'] = true;
1359
	else if (isset($wancfg['wireless']['hidessid']['enable']))
1360
		unset($wancfg['wireless']['hidessid']['enable']);
1361
	if ($_POST['mac_acl_enable'] == "yes")
1362
		$wancfg['wireless']['wpa']['mac_acl_enable'] = true;
1363
	else if (isset($wancfg['wireless']['wpa']['mac_acl_enable']))
1364
		unset($wancfg['wireless']['wpa']['mac_acl_enable']);
1365 c9e7d30d Scott Ullrich
	if ($_POST['rsn_preauth'] == "yes")
1366 ea62cd32 Scott Ullrich
		$wancfg['wireless']['wpa']['rsn_preauth'] = true;
1367 c0948c6c Renato Botelho
	else
1368 ea62cd32 Scott Ullrich
		unset($wancfg['wireless']['wpa']['rsn_preauth']);
1369 270c4607 Scott Ullrich
	if ($_POST['ieee8021x'] == "yes")
1370
		$wancfg['wireless']['wpa']['ieee8021x']['enable'] = true;
1371
	else if (isset($wancfg['wireless']['wpa']['ieee8021x']['enable']))
1372
		unset($wancfg['wireless']['wpa']['ieee8021x']['enable']);
1373
	if ($_POST['wpa_strict_rekey'] == "yes")
1374
		$wancfg['wireless']['wpa']['wpa_strict_rekey'] = true;
1375
	else if (isset($wancfg['wireless']['wpa']['wpa_strict_rekey']))
1376
		unset($wancfg['wireless']['wpa']['wpa_strict_rekey']);
1377
	if ($_POST['debug_mode'] == "yes")
1378
		$wancfg['wireless']['wpa']['debug_mode'] = true;
1379
	else if (isset($wancfg['wireless']['wpa']['debug_mode']))
1380
		sunset($wancfg['wireless']['wpa']['debug_mode']);
1381
	if ($_POST['wpa_enable'] == "yes")
1382
		$wancfg['wireless']['wpa']['enable'] = $_POST['wpa_enable'] = true;
1383
	else if (isset($wancfg['wireless']['wpa']['enable']))
1384
		unset($wancfg['wireless']['wpa']['enable']);
1385
	if ($_POST['wep_enable'] == "yes") {
1386
		if (!is_array($wancfg['wireless']['wep']))
1387
			$wancfg['wireless']['wep'] = array();
1388
		$wancfg['wireless']['wep']['enable'] = $_POST['wep_enable'] = true;
1389
	} else if (isset($wancfg['wireless']['wep']))
1390
		unset($wancfg['wireless']['wep']);
1391
	if ($_POST['wme_enable'] == "yes") {
1392
		if (!is_array($wancfg['wireless']['wme']))
1393
			$wancfg['wireless']['wme'] = array();
1394
		$wancfg['wireless']['wme']['enable'] = $_POST['wme_enable'] = true;
1395
	} else if (isset($wancfg['wireless']['wme']['enable']))
1396
		unset($wancfg['wireless']['wme']['enable']);
1397 57bbd532 Erik Fonnesbeck
	if ($_POST['puremode'] == "11g") {
1398 270c4607 Scott Ullrich
		if (!is_array($wancfg['wireless']['pureg']))
1399
			$wancfg['wireless']['pureg'] = array();
1400 57bbd532 Erik Fonnesbeck
		$wancfg['wireless']['pureg']['enable'] = true;
1401
	} else if ($_POST['puremode'] == "11n") {
1402 ed459692 Erik Fonnesbeck
		if (!is_array($wancfg['wireless']['puren']))
1403
			$wancfg['wireless']['puren'] = array();
1404 57bbd532 Erik Fonnesbeck
		$wancfg['wireless']['puren']['enable'] = true;
1405
	} else {
1406
		if (isset($wancfg['wireless']['pureg']))
1407
			unset($wancfg['wireless']['pureg']);
1408
		if (isset($wancfg['wireless']['puren']))
1409
			unset($wancfg['wireless']['puren']);
1410
	}
1411 270c4607 Scott Ullrich
	if ($_POST['apbridge_enable'] == "yes") {
1412
		if (!is_array($wancfg['wireless']['apbridge']))
1413
			$wancfg['wireless']['apbridge'] = array();
1414
		$wancfg['wireless']['apbridge']['enable'] = $_POST['apbridge_enable'] = true;
1415
	} else if (isset($wancfg['wireless']['apbridge']['enable']))
1416
		unset($wancfg['wireless']['apbridge']['enable']);
1417 9be20928 Erik Fonnesbeck
	if ($_POST['standard'] == "11g Turbo" || $_POST['standard'] == "11a Turbo") {
1418 270c4607 Scott Ullrich
		if (!is_array($wancfg['wireless']['turbo']))
1419
			$wancfg['wireless']['turbo'] = array();
1420
		$wancfg['wireless']['turbo']['enable'] = true;
1421
	} else if (isset($wancfg['wireless']['turbo']['enable']))
1422
		unset($wancfg['wireless']['turbo']['enable']);
1423
	$wancfg['wireless']['wep']['key'] = array();
1424
	for ($i = 1; $i <= 4; $i++) {
1425
		if ($_POST['key' . $i]) {
1426
			$newkey = array();
1427
			$newkey['value'] = $_POST['key' . $i];
1428
			if ($_POST['txkey'] == $i)
1429
				$newkey['txkey'] = true;
1430
			$wancfg['wireless']['wep']['key'][] = $newkey;
1431
		}
1432 5b237745 Scott Ullrich
	}
1433 8f0289e7 Erik Fonnesbeck
	interface_sync_wireless_clones($wancfg, true);
1434 5b237745 Scott Ullrich
}
1435 7f43ca88 Scott Ullrich
1436 597330aa Erik Fonnesbeck
function check_wireless_mode() {
1437 651fff4f Erik Fonnesbeck
	global $_POST, $config, $g, $wlan_modes, $wancfg, $if, $wlanif, $wlanbaseif, $old_wireless_mode, $input_errors;
1438 597330aa Erik Fonnesbeck
1439
	if ($wancfg['wireless']['mode'] == $_POST['mode'])
1440
		return;
1441
1442
	if (does_interface_exist(interface_get_wireless_clone($wlanbaseif)))
1443
		$clone_count = 1;
1444
	else
1445
		$clone_count = 0;
1446 6ef2297b Erik Fonnesbeck
	if (isset($config['wireless']['clone']) && is_array($config['wireless']['clone'])) {
1447 597330aa Erik Fonnesbeck
		foreach ($config['wireless']['clone'] as $clone) {
1448
			if ($clone['if'] == $wlanbaseif)
1449
				$clone_count++;
1450
		}
1451
	}
1452
	if ($clone_count > 1) {
1453
		$old_wireless_mode = $wancfg['wireless']['mode'];
1454
		$wancfg['wireless']['mode'] = $_POST['mode'];
1455
		if (!interface_wireless_clone("{$wlanif}_", $wancfg)) {
1456 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']]);
1457 597330aa Erik Fonnesbeck
		} else {
1458 d31ca336 Renato Botelho
			mwexec("/sbin/ifconfig " . escapeshellarg($wlanif) . "_ destroy");
1459 597330aa Erik Fonnesbeck
		}
1460
		$wancfg['wireless']['mode'] = $old_wireless_mode;
1461
	}
1462
}
1463
1464 509ca889 Evgeny Yurchenko
// Find all possible media options for the interface
1465
$mediaopts_list = array();
1466
$intrealname = $config['interfaces'][$if]['if'];
1467
exec("/sbin/ifconfig -m $intrealname | grep \"media \"", $mediaopts);
1468
foreach ($mediaopts as $mediaopt){
1469
	preg_match("/media (.*)/", $mediaopt, $matches);
1470 6d529efd Renato Botelho
	if (preg_match("/(.*) mediaopt (.*)/", $matches[1], $matches1)){
1471 509ca889 Evgeny Yurchenko
		// there is media + mediaopt like "media 1000baseT mediaopt full-duplex"
1472 6d529efd Renato Botelho
		array_push($mediaopts_list, $matches1[1] . " " . $matches1[2]);
1473 509ca889 Evgeny Yurchenko
	}else{
1474
		// there is only media like "media 1000baseT"
1475
		array_push($mediaopts_list, $matches[1]);
1476
	}
1477
}
1478
1479 a6d9251e Scott Ullrich
$pgtitle = array(gettext("Interfaces"), $pconfig['descr']);
1480 b32dd0a6 jim-p
$shortcut_section = "interfaces";
1481 af1e2031 jim-p
1482 58af5941 Scott Ullrich
$closehead = false;
1483 7f43ca88 Scott Ullrich
include("head.inc");
1484 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"));
1485 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"));
1486 7f43ca88 Scott Ullrich
1487 5b237745 Scott Ullrich
?>
1488 7f43ca88 Scott Ullrich
1489 8098302a Scott Ullrich
<script type="text/javascript" src="/javascript/numericupdown/js/numericupdown.js"></script>
1490 58af5941 Scott Ullrich
<link href="/javascript/numericupdown/css/numericupdown.css" rel="stylesheet" type="text/css" />
1491 8098302a Scott Ullrich
<script type="text/javascript" src="/javascript/datepicker/js/datepicker.js"></script>
1492
<link href="/javascript/datepicker/css/datepicker.css" rel="stylesheet" type="text/css"/>
1493 58af5941 Scott Ullrich
1494
<script type="text/javascript">
1495 6e31ca39 N0YB
//<![CDATA[
1496 9978e156 gnhb
	function updateType(t) {
1497 886f1f69 Scott Ullrich
		switch(t) {
1498 9978e156 gnhb
			case "none": {
1499 076b14b2 Vinicius Coque
				jQuery('#staticv4, #dhcp, #pppoe, #pptp, #ppp').hide();
1500 47593ac6 Seth Mos
				break;
1501
			}
1502
			case "staticv4": {
1503 076b14b2 Vinicius Coque
				jQuery('#none, #dhcp, #pppoe, #pptp, #ppp').hide();
1504 9978e156 gnhb
				break;
1505
			}
1506
			case "dhcp": {
1507 076b14b2 Vinicius Coque
				jQuery('#none, #staticv4, #pppoe, #pptp, #ppp').hide();
1508 6c05cfb0 gnhb
				break;
1509
			}
1510
			case "ppp": {
1511 076b14b2 Vinicius Coque
				jQuery('#none, #staticv4, #dhcp, #pptp, #pppoe').hide();
1512 3a906378 gnhb
				country_list();
1513 9978e156 gnhb
				break;
1514
			}
1515
			case "pppoe": {
1516 076b14b2 Vinicius Coque
				jQuery('#none, #staticv4, #dhcp, #pptp, #ppp').hide();
1517 9978e156 gnhb
				break;
1518
			}
1519 e4d40f41 gnhb
			case "l2tp":
1520 9978e156 gnhb
			case "pptp": {
1521 076b14b2 Vinicius Coque
				jQuery('#none, #staticv4, #dhcp, #pppoe, #ppp').hide();
1522
				jQuery('#pptp').show();
1523 9978e156 gnhb
				break;
1524 09583657 Scott Ullrich
			}
1525 886f1f69 Scott Ullrich
		}
1526 e4d40f41 gnhb
		if (t != "l2tp" && t != "pptp")
1527 076b14b2 Vinicius Coque
			jQuery('#'+t).show();
1528 09583657 Scott Ullrich
	}
1529 e029943a Seth Mos
	function updateTypeSix(t) {
1530 ca4467bc N0YB
		if (!isNaN(t[0])) t = '_' + t;
1531 e029943a Seth Mos
		switch(t) {
1532
			case "none": {
1533 6e31ca39 N0YB
				jQuery('#staticv6, #dhcp6, #_6rd, #_6to4, #track6, #slaac').hide();
1534 e029943a Seth Mos
				break;
1535
			}
1536
			case "staticv6": {
1537 6e31ca39 N0YB
				jQuery('#none, #dhcp6, #_6rd, #_6to4, #track6, #slaac').hide();
1538 feb88a14 smos
				break;
1539
			}
1540
			case "slaac": {
1541 6e31ca39 N0YB
				jQuery('#none, #staticv6, #_6rd, #_6to4, #track6, #dhcp6').hide();
1542 e029943a Seth Mos
				break;
1543
			}
1544
			case "dhcp6": {
1545 6e31ca39 N0YB
				jQuery('#none, #staticv6, #_6rd, #_6to4, #track6, #slaac').hide();
1546 7d567088 smos
				break;
1547
			}
1548 6e31ca39 N0YB
			case "_6rd": {
1549
				jQuery('#none, #dhcp6, #staticv6, #_6to4, #track6, #slaac').hide();
1550 31c43fd3 smos
				break;
1551
			}
1552 6e31ca39 N0YB
			case "_6to4": {
1553
				jQuery('#none, #dhcp6, #staticv6, #_6rd, #track6, #slaac').hide();
1554 20a7cb15 smos
				break;
1555
			}
1556
			case "track6": {
1557 6e31ca39 N0YB
				jQuery('#none, #dhcp6, #staticv6, #_6rd, #_6to4, #slaac').hide();
1558 986fd3d9 Renato Botelho
				update_track6_prefix();
1559 e029943a Seth Mos
				break;
1560
			}
1561
		}
1562
		if (t != "l2tp" && t != "pptp")
1563 076b14b2 Vinicius Coque
			jQuery('#'+t).show();
1564 e029943a Seth Mos
	}
1565 32764288 Namezero
1566 886f1f69 Scott Ullrich
	function show_allcfg(obj) {
1567
		if (obj.checked)
1568 076b14b2 Vinicius Coque
			jQuery('#allcfg').show();
1569 886f1f69 Scott Ullrich
		else
1570 076b14b2 Vinicius Coque
			jQuery('#allcfg').hide();
1571 886f1f69 Scott Ullrich
	}
1572 9978e156 gnhb
1573 d85ba87f gnhb
	function show_reset_settings(reset_type) {
1574 c0948c6c Renato Botelho
		if (reset_type == 'preset') {
1575 076b14b2 Vinicius Coque
			jQuery('#pppoepresetwrap').show();
1576
			jQuery('#pppoecustomwrap').hide();
1577 c0948c6c Renato Botelho
		}
1578
		else if (reset_type == 'custom') {
1579 076b14b2 Vinicius Coque
			jQuery('#pppoecustomwrap').show();
1580
			jQuery('#pppoepresetwrap').hide();
1581 d85ba87f gnhb
		} else {
1582 076b14b2 Vinicius Coque
			jQuery('#pppoecustomwrap').hide();
1583
			jQuery('#pppoepresetwrap').hide();
1584 d85ba87f gnhb
		}
1585
	}
1586 886f1f69 Scott Ullrich
	function show_mon_config() {
1587 076b14b2 Vinicius Coque
		jQuery("#showmonbox").html('');
1588
		jQuery('#showmon').css('display','block');
1589 886f1f69 Scott Ullrich
	}
1590 4634cb48 Ermal Luçi
1591 886f1f69 Scott Ullrich
	function openwindow(url) {
1592
		var oWin = window.open(url,"pfSensePop","width=620,height=400,top=150,left=150");
1593 c0948c6c Renato Botelho
		if (oWin==null || typeof(oWin)=="undefined")
1594 886f1f69 Scott Ullrich
			return false;
1595 c0948c6c Renato Botelho
		else
1596 886f1f69 Scott Ullrich
			return true;
1597
	}
1598 3a906378 gnhb
	function country_list() {
1599 076b14b2 Vinicius Coque
		jQuery('#country').children().remove();
1600 cfd3676d N0YB
		jQuery('#provider_list').children().remove();
1601 076b14b2 Vinicius Coque
		jQuery('#providerplan').children().remove();
1602
		jQuery.ajax("getserviceproviders.php",{
1603
			success: function(response) {
1604
				var responseTextArr = response.split("\n");
1605 3a906378 gnhb
				responseTextArr.sort();
1606
				responseTextArr.each( function(value) {
1607
					var option = new Element('option');
1608
					country = value.split(":");
1609
					option.text = country[0];
1610
					option.value = country[1];
1611 076b14b2 Vinicius Coque
					jQuery('#country').append(option);
1612 3a906378 gnhb
				});
1613
			}
1614
		});
1615 076b14b2 Vinicius Coque
		jQuery('#trcountry').css('display',"table-row");
1616 3a906378 gnhb
	}
1617 c0948c6c Renato Botelho
1618 3a906378 gnhb
	function providers_list() {
1619 4a2c47fe N0YB
		jQuery('#provider_list').children().remove();
1620 076b14b2 Vinicius Coque
		jQuery('#providerplan').children().remove();
1621
		jQuery.ajax("getserviceproviders.php",{
1622
			type: 'post',
1623
			data: {country : jQuery('#country').val()},
1624
			success: function(response) {
1625
				var responseTextArr = response.split("\n");
1626 3a906378 gnhb
				responseTextArr.sort();
1627
				responseTextArr.each( function(value) {
1628
					var option = new Element('option');
1629
					option.text = value;
1630
					option.value = value;
1631 4a2c47fe N0YB
					jQuery('#provider_list').append(option);
1632 3a906378 gnhb
				});
1633
			}
1634
		});
1635 076b14b2 Vinicius Coque
		jQuery('#trprovider').css("display","table-row");
1636
		jQuery('#trproviderplan').css("display","none");
1637 3a906378 gnhb
	}
1638 c0948c6c Renato Botelho
1639 3a906378 gnhb
	function providerplan_list() {
1640 076b14b2 Vinicius Coque
		jQuery('#providerplan').children().remove();
1641
		jQuery('#providerplan').append( new Element('option') );
1642
		jQuery.ajax("getserviceproviders.php",{
1643
			type: 'post',
1644 4a2c47fe N0YB
			data: {country : jQuery('#country').val(), provider : jQuery('#provider_list').val()},
1645 076b14b2 Vinicius Coque
			success: function(response) {
1646
				var responseTextArr = response.split("\n");
1647 3a906378 gnhb
				responseTextArr.sort();
1648
				responseTextArr.each( function(value) {
1649
					if(value != "") {
1650
						providerplan = value.split(":");
1651 c0948c6c Renato Botelho
1652 3a906378 gnhb
						var option = new Element('option');
1653
						option.text = providerplan[0] + " - " + providerplan[1];
1654
						option.value = providerplan[1];
1655 076b14b2 Vinicius Coque
						jQuery('#providerplan').append(option);
1656 3a906378 gnhb
					}
1657
				});
1658
			}
1659
		});
1660 076b14b2 Vinicius Coque
		jQuery('#trproviderplan').css("display","table-row");
1661 3a906378 gnhb
	}
1662 c0948c6c Renato Botelho
1663 3a906378 gnhb
	function prefill_provider() {
1664 076b14b2 Vinicius Coque
		jQuery.ajax("getserviceproviders.php",{
1665
			type: 'post',
1666 4a2c47fe N0YB
			data: {country : jQuery('#country').val(), provider : jQuery('#provider_list').val(), plan : jQuery('#providerplan').val()},
1667 076b14b2 Vinicius Coque
			success: function(data,textStatus,response) {
1668 3a906378 gnhb
				var xmldoc = response.responseXML;
1669
				var provider = xmldoc.getElementsByTagName('connection')[0];
1670 67877234 Phil Davis
				jQuery('#ppp_username').val('');
1671
				jQuery('#ppp_password').val('');
1672 3a906378 gnhb
				if(provider.getElementsByTagName('apn')[0].firstChild.data == "CDMA") {
1673 076b14b2 Vinicius Coque
					jQuery('#phone').val('#777');
1674
					jQuery('#apn').val('');
1675 3a906378 gnhb
				} else {
1676 076b14b2 Vinicius Coque
					jQuery('#phone').val('*99#');
1677
					jQuery('#apn').val(provider.getElementsByTagName('apn')[0].firstChild.data);
1678 3a906378 gnhb
				}
1679 67877234 Phil Davis
				ppp_username = provider.getElementsByTagName('ppp_username')[0].firstChild.data;
1680
				ppp_password = provider.getElementsByTagName('ppp_password')[0].firstChild.data;
1681
				jQuery('#ppp_username').val(ppp_username);
1682
				jQuery('#ppp_password').val(ppp_password);
1683 3a906378 gnhb
			}
1684
		});
1685
	}
1686
1687 986fd3d9 Renato Botelho
	function update_track6_prefix() {
1688
		var iface = jQuery("#track6-interface").val();
1689
		if (iface == null)
1690
			return;
1691
		var track6_prefix_ids = jQuery('#ipv6-num-prefix-ids-' + iface).val();
1692
		if (track6_prefix_ids == null)
1693
			return;
1694
		track6_prefix_ids = parseInt(track6_prefix_ids).toString(16);
1695
		jQuery('#track6-prefix-id-range').html('(<b>hexadecimal</b> from 0 to ' + track6_prefix_ids + ')');
1696
	}
1697
1698 6e31ca39 N0YB
//]]>
1699 5b237745 Scott Ullrich
</script>
1700 58af5941 Scott Ullrich
</head>
1701 886f1f69 Scott Ullrich
	<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
1702
	<?php include("fbegin.inc"); ?>
1703
	<form action="interfaces.php" method="post" name="iform" id="iform">
1704
		<?php if ($input_errors) print_input_errors($input_errors); ?>
1705 a368a026 Ermal Lu?i
		<?php if (is_subsystem_dirty('interfaces')): ?><p>
1706 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 />
1707 744ea190 Scott Ullrich
		<?php endif; ?>
1708
		<?php if ($savemsg) print_info_box($savemsg); ?>
1709 168549b9 Colin Fleming
		<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="interfaces">
1710 09583657 Scott Ullrich
			<tr>
1711 30ade846 gnhb
				<td id="mainarea">
1712
					<div class="tabcont">
1713 168549b9 Colin Fleming
					<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="tabs">
1714 09583657 Scott Ullrich
						<tr>
1715 136c598d Carlos Eduardo Ramos
							<td colspan="2" valign="top" class="listtopic"><?=gettext("General configuration"); ?></td>
1716 09583657 Scott Ullrich
						</tr>
1717
						<tr>
1718 136c598d Carlos Eduardo Ramos
							<td width="22%" valign="top" class="vncell"><?=gettext("Enable"); ?></td>
1719 30ade846 gnhb
							<td width="78%" class="vtable">
1720 339d2743 Colin Fleming
								<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable'] == true) echo "checked=\"checked\""; ?> onclick="show_allcfg(this);" />
1721 136c598d Carlos Eduardo Ramos
							<strong><?=gettext("Enable Interface"); ?></strong>
1722 09583657 Scott Ullrich
							</td>
1723
						</tr>
1724 30ade846 gnhb
					</table>
1725 6e31ca39 N0YB
					<div style="display:none;" id="allcfg">
1726 168549b9 Colin Fleming
					<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="allcfg">
1727 09583657 Scott Ullrich
						<tr>
1728 136c598d Carlos Eduardo Ramos
							<td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
1729 09583657 Scott Ullrich
							<td width="78%" class="vtable">
1730 2cbe4b47 Colin Fleming
								<input name="descr" type="text" class="formfld unknown" id="descr" size="30" value="<?=htmlspecialchars($pconfig['descr']);?>" />
1731 8cd558b6 ayvis
								<br /><span class="vexpl"><?= gettext("Enter a description (name) for the interface here."); ?></span>
1732 30ade846 gnhb
							</td>
1733
						</tr>
1734
						<tr>
1735 e029943a Seth Mos
							<td valign="middle" class="vncell"><strong><?=gettext("IPv4 Configuration Type"); ?></strong></td>
1736 c0948c6c Renato Botelho
							<td class="vtable">
1737 f3d88511 Renato Botelho
							<select name="type" onchange="updateType(this.value);" <?php echo $type_disabled; ?> class="formselect" id="type">
1738 c0948c6c Renato Botelho
								<?php
1739 e029943a Seth Mos
									foreach ($types4 as $key => $opt) {
1740 32b91bcf Colin Fleming
										echo "<option onclick=\"updateType('{$key}');\"";
1741 c0948c6c Renato Botelho
										if ($key == $pconfig['type'])
1742 339d2743 Colin Fleming
											echo " selected=\"selected\"";
1743 3a13f094 gnhb
										echo " value=\"{$key}\" >" . htmlspecialchars($opt);
1744
										echo "</option>";
1745 c0948c6c Renato Botelho
									}
1746 30ade846 gnhb
								?>
1747 667a3184 Scott Ullrich
								</select>
1748 30ade846 gnhb
							</td>
1749
						</tr>
1750 e029943a Seth Mos
						<tr>
1751
							<td valign="middle" class="vncell"><strong><?=gettext("IPv6 Configuration Type"); ?></strong></td>
1752
							<td class="vtable">
1753 f3d88511 Renato Botelho
							<select name="type6" onchange="updateTypeSix(this.value);" <?php echo $type_disabled; ?> class="formselect" id="type6">
1754 e029943a Seth Mos
								<?php
1755
									foreach ($types6 as $key => $opt) {
1756 32b91bcf Colin Fleming
										echo "<option onclick=\"updateTypeSix('{$key}');\"";
1757 e029943a Seth Mos
										if ($key == $pconfig['type6'])
1758 339d2743 Colin Fleming
											echo " selected=\"selected\"";
1759 e029943a Seth Mos
										echo " value=\"{$key}\" >" . htmlspecialchars($opt);
1760
										echo "</option>";
1761
									}
1762
								?>
1763
								</select>
1764
							</td>
1765
						</tr>
1766 30ade846 gnhb
						<tr>
1767 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("MAC address"); ?></td>
1768 30ade846 gnhb
							<td class="vtable">
1769 2cbe4b47 Colin Fleming
								<input name="spoofmac" type="text" class="formfld unknown" id="spoofmac" size="30" value="<?=htmlspecialchars($pconfig['spoofmac']);?>" />
1770 30ade846 gnhb
								<?php
1771
									$ip = getenv('REMOTE_ADDR');
1772
									$mac = `/usr/sbin/arp -an | grep {$ip} | cut -d" " -f4`;
1773
									$mac = str_replace("\n","",$mac);
1774
									if($mac):
1775
								?>
1776 32b91bcf Colin Fleming
									<a onclick="document.forms[0].spoofmac.value='<?=$mac?>';" href="#"><?=gettext("Insert my local MAC address"); ?></a>
1777 30ade846 gnhb
								<?php endif; ?>
1778 8cd558b6 ayvis
								<br />
1779 136c598d Carlos Eduardo Ramos
								<?=gettext("This field can be used to modify (\"spoof\") the MAC " .
1780 8cd558b6 ayvis
								"address of this interface"); ?><br />
1781
								<?=gettext("(may be required with some cable connections)"); ?><br />
1782 136c598d Carlos Eduardo Ramos
								<?=gettext("Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx " .
1783
								"or leave blank"); ?>
1784 30ade846 gnhb
							</td>
1785
						</tr>
1786
						<tr>
1787 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("MTU"); ?></td>
1788 c0948c6c Renato Botelho
							<td class="vtable">
1789 2cbe4b47 Colin Fleming
								<input name="mtu" type="text" class="formfld unknown" id="mtu" size="8" value="<?=htmlspecialchars($pconfig['mtu']);?>" />
1790 8cd558b6 ayvis
								<br />
1791 4a735210 Renato Botelho
								<?php
1792 0d0d4a27 Renato Botelho
									print gettext("If you leave this field blank, the adapter's default MTU will " .
1793
									"be used. This is typically 1500 bytes but can vary in some circumstances.");
1794 4a735210 Renato Botelho
								?>
1795 4cea5cf8 Ermal
							</td>
1796
						</tr>
1797
						<tr>
1798
							<td valign="top" class="vncell"><?=gettext("MSS"); ?></td>
1799 c0948c6c Renato Botelho
							<td class="vtable">
1800 2cbe4b47 Colin Fleming
								<input name="mss" type="text" class="formfld unknown" id="mss" size="8" value="<?=htmlspecialchars($pconfig['mss']);?>" />
1801 8cd558b6 ayvis
								<br />
1802 136c598d Carlos Eduardo Ramos
								<?=gettext("If you enter a value in this field, then MSS clamping for " .
1803 c0948c6c Renato Botelho
								"TCP connections to the value entered above minus 40 (TCP/IP " .
1804
								"header size) will be in effect."); ?>
1805 30ade846 gnhb
							</td>
1806
						</tr>
1807 6d529efd Renato Botelho
						<?php
1808 509ca889 Evgeny Yurchenko
						if (count($mediaopts_list) > 0){
1809
						$mediaopt_from_config = $config['interfaces'][$if]['media'] . ' ' . $config['interfaces'][$if]['mediaopt'];
1810
						echo "<tr>";
1811
							echo '<td valign="top" class="vncell">' . gettext("Speed and duplex") . '</td>';
1812
							echo '<td class="vtable">';
1813 6d529efd Renato Botelho
							echo '<div id="showadvmediabox"';
1814 6e2a15e6 Evgeny Yurchenko
								if ($mediaopt_from_config != 'autoselect ' && $mediaopt_from_config != ' ') echo " style='display:none'>";
1815
								else echo '>';
1816 2cbe4b47 Colin Fleming
								echo '<input type="button" onclick="show_advanced_media()" value="' . gettext("Advanced") . '" /> - ' . gettext("Show advanced option");
1817 6e2a15e6 Evgeny Yurchenko
							echo "</div>";
1818
							echo '<div id="showmediaadv" ';
1819
							if ($mediaopt_from_config == 'autoselect ' || $mediaopt_from_config == ' ') echo "style='display:none'>";
1820
							else echo '>';
1821 509ca889 Evgeny Yurchenko
								echo '<select name="mediaopt" class="formselect" id="mediaopt">';
1822 433e9842 jim-p
								print "<option value=\"\">Default (no preference, typically autoselect)</option>";
1823
								print "<option value=\"\">------- Media Supported by this interface -------</option>";
1824 509ca889 Evgeny Yurchenko
								foreach($mediaopts_list as $mediaopt){
1825
									if ($mediaopt != rtrim($mediaopt_from_config)){
1826
										print "<option value=\"$mediaopt\">" . gettext("$mediaopt") . "</option>";
1827
									} else {
1828 339d2743 Colin Fleming
										print "<option value=\"$mediaopt\" selected=\"selected\">" . gettext("$mediaopt") . "</option>";
1829 509ca889 Evgeny Yurchenko
									}
1830
								}
1831 8cd558b6 ayvis
								echo '</select><br />';
1832 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.");
1833 6e2a15e6 Evgeny Yurchenko
						echo '</div>';
1834 509ca889 Evgeny Yurchenko
							echo '</td>';
1835
						echo '</tr>';
1836
						}
1837
						?>
1838 30ade846 gnhb
						<tr>
1839
							<td colspan="2" valign="top" height="16"></td>
1840 c0948c6c Renato Botelho
						</tr>
1841 6e31ca39 N0YB
						<tr style="display:none;" id="none"><td style="display:none;"></td></tr>
1842
						<tr style="display:none;" id="staticv4">
1843 30ade846 gnhb
							<td colspan="2" style="padding:0px;">
1844 7a47e299 Renato Botelho
								<a name="gatewaysection"></a>
1845 168549b9 Colin Fleming
								<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="staticv4">
1846 30ade846 gnhb
									<tr>
1847 47593ac6 Seth Mos
										<td colspan="2" valign="top" class="listtopic"><?=gettext("Static IPv4 configuration"); ?></td>
1848 30ade846 gnhb
									</tr>
1849
									<tr>
1850 47593ac6 Seth Mos
										<td width="22%" valign="top" class="vncellreq"><?=gettext("IPv4 address"); ?></td>
1851 c0948c6c Renato Botelho
										<td width="78%" class="vtable">
1852 2cbe4b47 Colin Fleming
											<input name="ipaddr" type="text" class="formfld unknown" id="ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>" />
1853 30ade846 gnhb
											/
1854
											<select name="subnet" class="formselect" id="subnet">
1855
												<?php
1856
												for ($i = 32; $i > 0; $i--) {
1857 aac1c1db Chris Buechler
													echo "<option value=\"{$i}\" ";
1858
													if ($i == $pconfig['subnet']) echo "selected=\"selected\"";
1859
													echo ">" . $i . "</option>";
1860 30ade846 gnhb
												}
1861
												?>
1862
											</select>
1863
										</td>
1864
									</tr>
1865
									<tr>
1866 e2a6a6fb Phillip Davis
										<td width="22%" valign="top" class="vncell"><?=gettext("IPv4 Upstream Gateway"); ?></td>
1867 30ade846 gnhb
										<td width="78%" class="vtable">
1868
											<select name="gateway" class="formselect" id="gateway">
1869 339d2743 Colin Fleming
												<option value="none" selected="selected"><?=gettext("None"); ?></option>
1870 9978e156 gnhb
													<?php
1871 30ade846 gnhb
													if(count($a_gateways) > 0) {
1872
														foreach ($a_gateways as $gateway) {
1873 47593ac6 Seth Mos
															if(($gateway['interface'] == $if)  && (is_ipaddrv4($gateway['gateway']))) {
1874 9978e156 gnhb
													?>
1875 339d2743 Colin Fleming
															<option value="<?=$gateway['name'];?>" <?php if ($gateway['name'] == $pconfig['gateway']) echo "selected=\"selected\""; ?>>
1876 30ade846 gnhb
																<?=htmlspecialchars($gateway['name']) . " - " . htmlspecialchars($gateway['gateway']);?>
1877
															</option>
1878
													<?php
1879
															}
1880
														}
1881
													}
1882
													?>
1883
											</select>
1884 32b91bcf Colin Fleming
											- or  <strong><a onclick="show_add_gateway();" href="#gatewaysection"><?=gettext("add a new one."); ?></a></strong>
1885 8cd558b6 ayvis
											<br />
1886 30ade846 gnhb
											<div id='addgwbox'>
1887 8cd558b6 ayvis
												<?=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 />
1888 e2a6a6fb Phillip Davis
												<?=gettext("On local LANs the upstream gateway should be \"none\"."); ?>
1889 30ade846 gnhb
											</div>
1890
											<div id='notebox'>
1891
											</div>
1892
											<div id="status">
1893 c0948c6c Renato Botelho
											</div>
1894 6e31ca39 N0YB
											<div style="display:none" id="addgateway">
1895 168549b9 Colin Fleming
												<p>&nbsp;</p>
1896
												<table border="1" class="addgatewaybox" summary="addgateway">
1897 9978e156 gnhb
													<tr>
1898 30ade846 gnhb
														<td>
1899 168549b9 Colin Fleming
															<table class="addgatewaybox" cellpadding="1" cellspacing="1" summary="addgateway">
1900 bd10508a N0YB
																<tr><td>&nbsp;</td></tr>
1901 30ade846 gnhb
																<tr>
1902 933ea015 Carlos Eduardo Ramos
																	<td colspan="2"><center><b><font color="white"><?=gettext("Add new gateway:"); ?></font></b></center></td>
1903 30ade846 gnhb
																</tr>
1904 bd10508a N0YB
																<tr><td>&nbsp;</td></tr>
1905 30ade846 gnhb
																<?php
1906
																if($if == "wan" || $if == "WAN")
1907 339d2743 Colin Fleming
																	$checked = " checked=\"checked\"";
1908 30ade846 gnhb
																?>
1909
																<tr>
1910 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>
1911 c0948c6c Renato Botelho
																</tr>
1912 30ade846 gnhb
																<tr>
1913 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>
1914 30ade846 gnhb
																</tr>
1915
																<tr>
1916 2cbe4b47 Colin Fleming
																	<td align="right"><font color="white"><?=gettext("Gateway IPv4:"); ?></font></td><td><input id="gatewayip" name="gatewayip" /></td>
1917 30ade846 gnhb
																</tr>
1918
																<tr>
1919 168549b9 Colin Fleming
																	<td align="right"><font color="white"><?=gettext("Description:"); ?></font></td><td><input id="gatewaydescr" name="gatewaydescr" /></td>
1920 30ade846 gnhb
																</tr>
1921 bd10508a N0YB
																<tr><td>&nbsp;</td></tr>
1922 30ade846 gnhb
																<tr>
1923 bd10508a N0YB
																	<td colspan="2">
1924 30ade846 gnhb
																		<center>
1925
																			<div id='savebuttondiv'>
1926 168549b9 Colin Fleming
																				<input id="gwsave" type="button" value="<?=gettext("Save Gateway"); ?>" onclick='hide_add_gatewaysave();' />
1927
																				<input id="gwcancel" type="button" value="<?=gettext("Cancel"); ?>" onclick='hide_add_gateway();' />
1928 30ade846 gnhb
																			</div>
1929
																		</center>
1930
																	</td>
1931
																</tr>
1932 93ee6323 gnhb
																<tr><td>&nbsp;</td></tr>
1933 30ade846 gnhb
															</table>
1934 9978e156 gnhb
														</td>
1935
													</tr>
1936
												</table>
1937 30ade846 gnhb
											</div>
1938
										</td>
1939
									</tr>
1940 a236affe N0YB
									<tr>
1941
										<td colspan="2" valign="top" height="16"></td>
1942
									</tr>
1943 30ade846 gnhb
								</table>
1944
							</td>
1945
						</tr>
1946 6e31ca39 N0YB
						<tr style="display:none;" id="staticv6">
1947 47593ac6 Seth Mos
							<td colspan="2" style="padding:0px;">
1948 7a47e299 Renato Botelho
								<a name="gatewayv6section"></a>
1949 168549b9 Colin Fleming
								<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="staticv6">
1950 47593ac6 Seth Mos
									<tr>
1951
										<td colspan="2" valign="top" class="listtopic"><?=gettext("Static IPv6 configuration"); ?></td>
1952
									</tr>
1953
									<tr>
1954
										<td width="22%" valign="top" class="vncellreq"><?=gettext("IPv6 address"); ?></td>
1955
										<td width="78%" class="vtable">
1956 2cbe4b47 Colin Fleming
											<input name="ipaddrv6" type="text" class="formfld unknown" id="ipaddrv6" size="28" value="<?=htmlspecialchars($pconfig['ipaddrv6']);?>" />
1957 47593ac6 Seth Mos
											/
1958 85e9cfee Phil Davis
											<select name="subnetv6" class="formselect" id="subnetv6">
1959 47593ac6 Seth Mos
												<?php
1960
												for ($i = 128; $i > 0; $i--) {
1961 2727e3fc Chris Buechler
													echo "<option value=\"{$i}\" ";
1962
													if ($i == $pconfig['subnetv6']) echo "selected=\"selected\"";
1963
													echo ">" . $i . "</option>";
1964 47593ac6 Seth Mos
												}
1965
												?>
1966
											</select>
1967
										</td>
1968
									</tr>
1969
									<tr>
1970 e2a6a6fb Phillip Davis
										<td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Upstream Gateway"); ?></td>
1971 47593ac6 Seth Mos
										<td width="78%" class="vtable">
1972
											<select name="gatewayv6" class="formselect" id="gatewayv6">
1973 339d2743 Colin Fleming
												<option value="none" selected="selected"><?=gettext("None"); ?></option>
1974 47593ac6 Seth Mos
													<?php
1975
													if(count($a_gateways) > 0) {
1976
														foreach ($a_gateways as $gateway) {
1977
															if(($gateway['interface'] == $if) && (is_ipaddrv6($gateway['gateway']))) {
1978
													?>
1979 339d2743 Colin Fleming
															<option value="<?=$gateway['name'];?>" <?php if ($gateway['name'] == $pconfig['gatewayv6']) echo "selected=\"selected\""; ?>>
1980 47593ac6 Seth Mos
																<?=htmlspecialchars($gateway['name']) . " - " . htmlspecialchars($gateway['gateway']);?>
1981
															</option>
1982
													<?php
1983
															}
1984
														}
1985
													}
1986
													?>
1987
											</select>
1988 32b91bcf Colin Fleming
											- or <strong><a onclick="show_add_gateway_v6();" href="#gatewayv6section"><?=gettext("add a new one."); ?></a></strong>
1989 8cd558b6 ayvis
											<br />
1990 cfd40454 Seth Mos
											<div id='addgwboxv6'>
1991 8cd558b6 ayvis
												<?=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 />
1992 e2a6a6fb Phillip Davis
												<?=gettext("On local LANs the upstream gateway should be \"none\"."); ?>
1993 47593ac6 Seth Mos
											</div>
1994 cfd40454 Seth Mos
											<div id='noteboxv6'>
1995 47593ac6 Seth Mos
											</div>
1996 cfd40454 Seth Mos
											<div id="statusv6">
1997 47593ac6 Seth Mos
											</div>
1998 6e31ca39 N0YB
											<div style="display:none" id="addgatewayv6">
1999 168549b9 Colin Fleming
												<p>&nbsp;</p>
2000
												<table border="1" class="addgatewaybox" summary="addgatewayv6">
2001 47593ac6 Seth Mos
													<tr>
2002
														<td>
2003 168549b9 Colin Fleming
															<table class="addgatewaybox" cellpadding="1" cellspacing="1" summary="addgatewayv6">
2004 bd10508a N0YB
																<tr><td>&nbsp;</td></tr>
2005 47593ac6 Seth Mos
																<tr>
2006
																	<td colspan="2"><center><b><font color="white"><?=gettext("Add new v6 gateway:"); ?></font></b></center></td>
2007
																</tr>
2008 bd10508a N0YB
																<tr><td>&nbsp;</td></tr>
2009 47593ac6 Seth Mos
																<?php
2010
																if($if == "wan" || $if == "WAN")
2011 339d2743 Colin Fleming
																	$checked = " checked=\"checked\"";
2012 47593ac6 Seth Mos
																?>
2013
																<tr>
2014 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>
2015 47593ac6 Seth Mos
																</tr>
2016
																<tr>
2017 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>
2018 47593ac6 Seth Mos
																</tr>
2019
																<tr>
2020 168549b9 Colin Fleming
																	<td align="right"><font color="white"><?=gettext("Gateway IPv6:"); ?></font></td><td><input id="gatewayipv6" name="gatewayipv6" /></td>
2021 47593ac6 Seth Mos
																</tr>
2022
																<tr>
2023 2cbe4b47 Colin Fleming
																	<td align="right"><font color="white"><?=gettext("Description:"); ?></font></td><td><input id="gatewaydescrv6" name="gatewaydescrv6" /></td>
2024 47593ac6 Seth Mos
																</tr>
2025 bd10508a N0YB
																<tr><td>&nbsp;</td></tr>
2026 47593ac6 Seth Mos
																<tr>
2027 bd10508a N0YB
																	<td colspan="2">
2028 47593ac6 Seth Mos
																		<center>
2029 cfd40454 Seth Mos
																			<div id='savebuttondivv6'>
2030 168549b9 Colin Fleming
																				<input id="gwsavev6" type="button" value="<?=gettext("Save Gateway"); ?>" onclick='hide_add_gatewaysave_v6();' />
2031
																				<input id="gwcancelv6" type="button" value="<?=gettext("Cancel"); ?>" onclick='hide_add_gateway_v6();' />
2032 47593ac6 Seth Mos
																			</div>
2033
																		</center>
2034
																	</td>
2035
																</tr>
2036
																<tr><td>&nbsp;</td></tr>
2037
															</table>
2038
														</td>
2039
													</tr>
2040
												</table>
2041
											</div>
2042
										</td>
2043
									</tr>
2044 a236affe N0YB
									<tr>
2045
										<td colspan="2" valign="top" height="16"></td>
2046
									</tr>
2047 47593ac6 Seth Mos
								</table>
2048
							</td>
2049
						</tr>
2050 6e31ca39 N0YB
						<tr style="display:none;" id="dhcp">
2051 30ade846 gnhb
							<td colspan="2" style="padding: 0px;">
2052 168549b9 Colin Fleming
								<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="dhcp">
2053 30ade846 gnhb
									<tr>
2054 6e31ca39 N0YB
										<td colspan="2" valign="top" class="listtopic"><?=gettext("DHCP client configuration &nbsp; &nbsp; " .
2055
										' <input name="adv_dhcp_config_advanced" type="checkbox" id="adv_dhcp_config_advanced" value="" onclick="show_adv_dhcp_config(this)" /> ' .
2056
										" Advanced &nbsp; &nbsp; " .
2057
										' <input name="adv_dhcp_config_file_override" type="checkbox" id="adv_dhcp_config_file_override" value="" onclick="show_adv_dhcp_config(this)" /> ' .
2058
										" Config File Override &nbsp; &nbsp; "); ?>
2059 f4dd8b4c N0YB
										</td>
2060 30ade846 gnhb
									</tr>
2061 e4d40f41 gnhb
									<!-- Uncomment to expose DHCP+ in GUI
2062
									<tr>
2063
										<td width="22%" valign="top" class="vncell"><?=gettext("Enable DHCP+"); ?></td>
2064
										<td width="78%" class="vtable">
2065 339d2743 Colin Fleming
											<input name="dhcp_plus" type="checkbox" value="yes" <?php if ($pconfig['dhcp_plus'] == true) echo "checked=\"checked\""; ?> />
2066 e4d40f41 gnhb
										<strong><?=gettext("Enable DHCP+L2TP or DHCP+PPTP."); ?></strong>
2067 8cd558b6 ayvis
										<br />
2068 e4d40f41 gnhb
										<?=gettext("Status changes on this interface will trigger reconfiguration (if necessary) of the associated PPTP/L2TP link."); ?>
2069
										</td>
2070
									</tr>
2071
									-->
2072 6e31ca39 N0YB
									<tr style='display:none' id="show_basic_dhcphostname">
2073 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Hostname"); ?></td>
2074 30ade846 gnhb
										<td width="78%" class="vtable">
2075 2cbe4b47 Colin Fleming
											<input name="dhcphostname" type="text" class="formfld unknown" id="dhcphostname" size="40" value="<?=htmlspecialchars($pconfig['dhcphostname']);?>" />
2076 8cd558b6 ayvis
											<br />
2077 136c598d Carlos Eduardo Ramos
											<?=gettext("The value in this field is sent as the DHCP client identifier " .
2078
											"and hostname when requesting a DHCP lease. Some ISPs may require " .
2079 933ea015 Carlos Eduardo Ramos
											"this (for client identification)."); ?>
2080 30ade846 gnhb
										</td>
2081
									</tr>
2082 6e31ca39 N0YB
									<tr style='display:none' id="show_basic_dhcpalias-address">
2083 ed395640 Seth Mos
										<td width="22%" valign="top" class="vncell"><?=gettext("Alias IPv4 address"); ?></td>
2084
										<td width="78%" class="vtable">
2085 2cbe4b47 Colin Fleming
											<input name="alias-address" type="text" class="formfld unknown" id="alias-address" size="20" value="<?=htmlspecialchars($pconfig['alias-address']);?>" />
2086 ed395640 Seth Mos
											<select name="alias-subnet" class="formselect" id="alias-subnet">
2087
												<?php
2088
												for ($i = 32; $i > 0; $i--) {
2089 aac1c1db Chris Buechler
													echo "<option value=\"{$i}\" ";
2090
													if ($i == $pconfig['alias-subnet']) echo "selected=\"selected\"";
2091
													echo ">" . $i . "</option>";
2092 ed395640 Seth Mos
												}
2093
												?>
2094
											</select>
2095
											<?=gettext("The value in this field is used as a fixed alias IPv4 address by the " .
2096
											"DHCP client."); ?>
2097
										</td>
2098 bfab2419 smos
									</tr>
2099 6e31ca39 N0YB
									<tr style='display:none' id="show_basic_dhcprejectlease">
2100 57c83fd6 jim-p
										<td width="22%" valign="top" class="vncell"><?=gettext("Reject Leases From"); ?></td>
2101
										<td width="78%" class="vtable">
2102
											<input name="dhcprejectfrom" type="text" class="formfld unknown" id="dhcprejectfrom" size="20" value="<?=htmlspecialchars($pconfig['dhcprejectfrom']);?>" />
2103 8cd558b6 ayvis
											<br />
2104 57c83fd6 jim-p
											<?=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."); ?>
2105 61ca05e2 N0YB
											<?=gettext("This is useful for rejecting leases from cable modems that offer private IPs when they lose upstream sync."); ?>
2106 57c83fd6 jim-p
										</td>
2107
									</tr>
2108 f4dd8b4c N0YB
2109 6e31ca39 N0YB
									<tr style='display:none' id="show_adv_dhcp_protocol_timing">
2110 ce668fcd Colin Fleming
										<td width="22%" valign="top" class="vncell"><a target="_blank" href="http://www.freebsd.org/cgi/man.cgi?query=dhclient.conf&amp;sektion=5#PROTOCOL_TIMING"><?=gettext("Protocol Timing"); ?></a></td>
2111 f4dd8b4c N0YB
										<td width="48%" class="vtable">
2112 6e31ca39 N0YB
											Timeout: <input name="adv_dhcp_pt_timeout" type="text" class="formfld unknown" id="adv_dhcp_pt_timeout" size="2" value="<?=htmlspecialchars($pconfig['adv_dhcp_pt_timeout']);?>" onchange="customdhcpptcheckradiobuton(document.iform.adv_dhcp_pt_values, '');" />
2113
											Retry:   <input name="adv_dhcp_pt_retry"   type="text" class="formfld unknown" id="adv_dhcp_pt_retry"   size="2" value="<?=htmlspecialchars($pconfig['adv_dhcp_pt_retry']);?>"   onchange="customdhcpptcheckradiobuton(document.iform.adv_dhcp_pt_values, '');" />
2114
											Select Timeout: <input name="adv_dhcp_pt_select_timeout" type="text" class="formfld unknown" id="adv_dhcp_pt_select_timeout" size="2" value="<?=htmlspecialchars($pconfig['adv_dhcp_pt_select_timeout']);?>" onchange="customdhcpptcheckradiobuton(document.iform.adv_dhcp_pt_values, '');" />
2115 f4dd8b4c N0YB
2116 6e31ca39 N0YB
											&nbsp; &nbsp; &nbsp; &nbsp; 
2117
											Presets: &nbsp;
2118
											<input name="adv_dhcp_pt_values" type="radio" value="DHCP"	id="customdhcpptdhcpdefaults"	onclick="customdhcpptsetvalues(this, iform);" />FreeBSD Default &nbsp; 
2119
											<input name="adv_dhcp_pt_values" type="radio" value="Clear"	id="customdhcpptclear"		onclick="customdhcpptsetvalues(this, iform);" />Clear
2120 f4dd8b4c N0YB
2121 8cd558b6 ayvis
											<br />
2122 6e31ca39 N0YB
											Reboot: <input name="adv_dhcp_pt_reboot" type="text" class="formfld unknown" id="adv_dhcp_pt_reboot" size="2" value="<?=htmlspecialchars($pconfig['adv_dhcp_pt_reboot']);?>" onchange="customdhcpptcheckradiobuton(document.iform.adv_dhcp_pt_values, '');" />
2123
											Backoff Cutoff:   <input name="adv_dhcp_pt_backoff_cutoff"   type="text" class="formfld unknown" id="adv_dhcp_pt_backoff_cutoff"   size="2" value="<?=htmlspecialchars($pconfig['adv_dhcp_pt_backoff_cutoff']);?>"   onchange="customdhcpptcheckradiobuton(document.iform.adv_dhcp_pt_values, '');" />
2124
											Initial Interval: <input name="adv_dhcp_pt_initial_interval" type="text" class="formfld unknown" id="adv_dhcp_pt_initial_interval" size="2" value="<?=htmlspecialchars($pconfig['adv_dhcp_pt_initial_interval']);?>" onchange="customdhcpptcheckradiobuton(document.iform.adv_dhcp_pt_values, '');" />
2125 f4dd8b4c N0YB
2126 6e31ca39 N0YB
											&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
2127
											<input name="adv_dhcp_pt_values" type="radio" value="pfSense"	id="customdhcpptpfsensedefaults"	onclick="customdhcpptsetvalues(this, iform);" />pfSense Default &nbsp; 
2128
											<input name="adv_dhcp_pt_values" type="radio" value="SavedCfg" checked="checked"	id="customdhcpptsavedcfg"		onclick="customdhcpptsetvalues(this, iform);" />Saved Cfg 
2129 f4dd8b4c N0YB
2130 8cd558b6 ayvis
											<br />
2131
											<?=gettext("The values in these fields are DHCP protocol timings used when requesting a lease. <br /> " ); ?>
2132 f4dd8b4c N0YB
2133
											<script type="text/javascript">
2134 6e31ca39 N0YB
											//<![CDATA[
2135 f4dd8b4c N0YB
												function customdhcpptcheckradiobuton(T, BUTTON) {
2136
													for (var i = 0; i < T.length; i++) {
2137
														T[i].checked = false;
2138
														if (T[i].value == BUTTON) T[i].checked = true;
2139
													}
2140
													T.value = BUTTON;
2141
												}
2142
2143
												function customdhcpptsetvalues(T, FORM) {
2144
													// timeout, retry, select-timeout, reboot, backoff-cutoff, initial-interval
2145
													if (T.value == "DHCP")		customdhcpptsetvaluesnow(T, FORM, "60", "300", "0", "10", "120", "10");
2146
													if (T.value == "pfSense")	customdhcpptsetvaluesnow(T, FORM, "60", "15", "0", "", "", "1");
2147
													if (T.value == "SavedCfg")	customdhcpptsetvaluesnow(T, FORM, "<?=htmlspecialchars($pconfig['adv_dhcp_pt_timeout']);?>", "<?=htmlspecialchars($pconfig['adv_dhcp_pt_retry']);?>", "<?=htmlspecialchars($pconfig['adv_dhcp_pt_select_timeout']);?>", "<?=htmlspecialchars($pconfig['adv_dhcp_pt_reboot']);?>", "<?=htmlspecialchars($pconfig['adv_dhcp_pt_backoff_cutoff']);?>", "<?=htmlspecialchars($pconfig['adv_dhcp_pt_initial_interval']);?>");
2148
													if (T.value == "Clear")		customdhcpptsetvaluesnow(T, FORM, "", "", "", "", "", "");
2149
												}
2150
2151
												function customdhcpptsetvaluesnow(T, FORM, timeout, retry, selecttimeout, reboot, backoffcutoff, initialinterval) {
2152
													FORM.adv_dhcp_pt_timeout.value = timeout;
2153
													FORM.adv_dhcp_pt_retry.value = retry;
2154
													FORM.adv_dhcp_pt_select_timeout.value = selecttimeout;
2155
													FORM.adv_dhcp_pt_reboot.value = reboot;
2156
													FORM.adv_dhcp_pt_backoff_cutoff.value = backoffcutoff;
2157
													FORM.adv_dhcp_pt_initial_interval.value = initialinterval;
2158
2159
													FORM.adv_dhcp_pt_values.value = T.value;
2160
												}
2161
2162
												<!-- Set the adv_dhcp_pt_values radio button from saved config -->
2163
												var RADIOBUTTON_VALUE = "<?=htmlspecialchars($pconfig['adv_dhcp_pt_values']);?>";
2164
												if (RADIOBUTTON_VALUE == "") RADIOBUTTON_VALUE = "SavedCfg";
2165
												customdhcpptcheckradiobuton(document.iform.adv_dhcp_pt_values, RADIOBUTTON_VALUE);
2166 6e31ca39 N0YB
											//]]>
2167 f4dd8b4c N0YB
											</script>
2168
										</td>
2169 a236affe N0YB
									</tr>
2170 f4dd8b4c N0YB
2171 6e31ca39 N0YB
									<tr style='display:none' id="show_adv_dhcp_lease_requirements_and_requests">
2172
										<td width="22%" valign="top" class="vncell"><?=gettext("<a target=\"FreeBSD_DHCP\" href=\"http://www.freebsd.org/cgi/man.cgi?query=dhclient.conf&amp;sektion=5#LEASE_REQUIREMENTS_AND_REQUESTS\">Lease Requirements and Requests</a>"); ?></td>
2173 f4dd8b4c N0YB
										<td width="78%" class="vtable">
2174 8cd558b6 ayvis
											<?=gettext("<a target=\"FreeBSD_DHCP\" href=\"http://www.freebsd.org/cgi/man.cgi?query=dhclient.conf&amp;sektion=5#LEASE_REQUIREMENTS_AND_REQUESTS\">Send</a> <a target=\"FreeBSD_DHCP\" href=\"http://www.freebsd.org/cgi/man.cgi?query=dhcp-options&amp;sektion=5\">Options</a>"); ?><br />
2175 6e31ca39 N0YB
											<input name="adv_dhcp_send_options" type="text" class="formfld unknown" id="adv_dhcp_send_options" size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp_send_options']);?>" />
2176 8cd558b6 ayvis
											<br />
2177
											<?=gettext("The values in this field are DHCP options to be sent when requesting a DHCP lease.  [option declaration [, ...]] <br />" .
2178
											"Value Substitutions: {interface}, {hostname}, {mac_addr_asciiCD}, {mac_addr_hexCD} <br />" .
2179
											"Where C is U(pper) or L(ower) Case, and D is \" :-.\" Delimiter (space, colon, hyphen, or period) (omitted for none). <br />" .
2180 f4dd8b4c N0YB
											"Some ISPs may require certain options be or not be sent. "); ?>
2181 6e31ca39 N0YB
											<hr/>
2182 8cd558b6 ayvis
											<?=gettext("<a target=\"FreeBSD_DHCP\" href=\"http://www.freebsd.org/cgi/man.cgi?query=dhclient.conf&amp;sektion=5#LEASE_REQUIREMENTS_AND_REQUESTS\">Request</a> <a target=\"FreeBSD_DHCP\" href=\"http://www.freebsd.org/cgi/man.cgi?query=dhcp-options&amp;sektion=5\">Options</a>"); ?><br />
2183 6e31ca39 N0YB
											<input name="adv_dhcp_request_options" type="text" class="formfld unknown" id="adv_dhcp_request_options" size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp_request_options']);?>" />
2184 8cd558b6 ayvis
											<br />
2185
											<?=gettext("The values in this field are DHCP option 55 to be sent when requesting a DHCP lease.  [option [, ...]] <br />" .
2186 f4dd8b4c N0YB
											"Some ISPs may require certain options be or not be requested. "); ?>
2187 6e31ca39 N0YB
											<hr/>
2188 8cd558b6 ayvis
											<?=gettext("<a target=\"FreeBSD_DHCP\" href=\"http://www.freebsd.org/cgi/man.cgi?query=dhclient.conf&amp;sektion=5#LEASE_REQUIREMENTS_AND_REQUESTS\">Require</a> <a target=\"FreeBSD_DHCP\" href=\"http://www.freebsd.org/cgi/man.cgi?query=dhcp-options&amp;sektion=5\">Options</a>"); ?><br />
2189 6e31ca39 N0YB
											<input name="adv_dhcp_required_options" type="text" class="formfld unknown" id="adv_dhcp_required_options" size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp_required_options']);?>" />
2190 8cd558b6 ayvis
											<br />
2191 c54b4586 Renato Botelho
											<?=gettext("The values in this field are DHCP options required by the client when requesting a DHCP lease.  [option [, ...]] "); ?>
2192 f4dd8b4c N0YB
										</td>
2193
									</tr>
2194
2195 6e31ca39 N0YB
									<tr style='display:none' id="show_adv_dhcp_option_modifiers">
2196
										<td width="22%" valign="top" class="vncell"><?=gettext("<a target=\"FreeBSD_DHCP\" href=\"http://www.freebsd.org/cgi/man.cgi?query=dhcp-options&amp;sektion=5\">Option</a> <a target=\"FreeBSD_DHCP\" href=\"http://www.freebsd.org/cgi/man.cgi?query=dhclient.conf&amp;sektion=5#OPTION_MODIFIERS\">Modifiers</a>"); ?></td>
2197 f4dd8b4c N0YB
										<td width="78%" class="vtable">
2198 6e31ca39 N0YB
											<input name="adv_dhcp_option_modifiers" type="text" class="formfld unknown" id="adv_dhcp_option_modifiers" size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp_option_modifiers']);?>" />
2199 8cd558b6 ayvis
											<br />
2200
											<?=gettext("The values in this field are DHCP option modifiers applied to obtained DHCP lease.  [modifier option declaration [, ...]] <br /> " .
2201 f4dd8b4c N0YB
											"modifiers: (default, supersede, prepend, append)"); ?>
2202
										</td>
2203
									</tr>
2204
2205 6e31ca39 N0YB
									<tr style='display:none' id="show_adv_dhcp_config_file_override">
2206
										<td width="22%" valign="top" class="vncell"><?=gettext("<a target=\"FreeBSD_DHCP\" href=\"http://www.freebsd.org/cgi/man.cgi?query=dhclient.conf&amp;sektion=5\">Configuration File</a> Override"); ?></td>
2207 f4dd8b4c N0YB
										<td width="78%" class="vtable">
2208 6e31ca39 N0YB
 											<input name="adv_dhcp_config_file_override_path"   type="text" class="formfld unknown" id="adv_dhcp_config_file_override_path"  size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp_config_file_override_path']);?>" />
2209 8cd558b6 ayvis
											<br />
2210
											<?=gettext("The value in this field is the full absolute path to a DHCP client configuration file.  [/[dirname/[.../]]filename[.ext]] <br /> " .
2211
											"Value Substitutions in Config File: {interface}, {hostname}, {mac_addr_asciiCD}, {mac_addr_hexCD} <br />" .
2212
											"Where C is U(pper) or L(ower) Case, and D is \" :-.\" Delimiter (space, colon, hyphen, or period) (omitted for none). <br />" .
2213 f4dd8b4c N0YB
											"Some ISPs may require certain options be or not be sent. "); ?>
2214
										</td>
2215 a236affe N0YB
									</tr>
2216 f4dd8b4c N0YB
2217
 									<tr>
2218
 										<td colspan="2" valign="top" height="16"></td>
2219
 									</tr>
2220
2221 6e31ca39 N0YB
								</table>
2222
2223 f4dd8b4c N0YB
									<script type="text/javascript">
2224 6e31ca39 N0YB
									//<![CDATA[
2225 f4dd8b4c N0YB
										function show_adv_dhcp_config(T) {
2226
2227
											if (T.checked) T.value = "Selected";
2228
											else T.value = "";
2229
2230
											     if (document.iform.adv_dhcp_config_file_override.checked)	show_hide_adv_dhcp('none', 'none', '');
2231
											else if (document.iform.adv_dhcp_config_advanced.checked)	show_hide_adv_dhcp('', '', 'none');
2232
											else 									show_hide_adv_dhcp('', 'none', 'none');
2233
										}
2234
2235
										function show_hide_adv_dhcp(basic, advanced, override) {
2236
2237
											document.getElementById("show_basic_dhcphostname").style.display = basic;
2238
											document.getElementById("show_basic_dhcpalias-address").style.display = basic;
2239 63c704c3 N0YB
											document.getElementById("show_basic_dhcprejectlease").style.display = basic;
2240 f4dd8b4c N0YB
2241 336d4f04 N0YB
											document.getElementById("show_adv_dhcp_protocol_timing").style.display = advanced;
2242
											document.getElementById("show_adv_dhcp_lease_requirements_and_requests").style.display = advanced;
2243 f4dd8b4c N0YB
											document.getElementById("show_adv_dhcp_option_modifiers").style.display = advanced;
2244
2245
											document.getElementById("show_adv_dhcp_config_file_override").style.display = override;
2246
										}
2247
2248
										<!-- Set the adv_dhcp_config_advanced checkbox from saved config -->
2249
										if ("<?=htmlspecialchars($pconfig['adv_dhcp_config_advanced']);?>" == "Selected") document.iform.adv_dhcp_config_advanced.checked = true;
2250
										show_adv_dhcp_config(document.iform.adv_dhcp_config_advanced);
2251
2252
										<!-- Set the adv_dhcp_config_file_override checkbox from saved config -->
2253
										if ("<?=htmlspecialchars($pconfig['adv_dhcp_config_file_override']);?>" == "Selected") document.iform.adv_dhcp_config_file_override.checked = true;
2254
										show_adv_dhcp_config(document.iform.adv_dhcp_config_file_override);
2255 6e31ca39 N0YB
									//]]>
2256 f4dd8b4c N0YB
									</script>
2257
2258 e029943a Seth Mos
							</td>
2259
						</tr>
2260 6e31ca39 N0YB
						<tr style="display:none;" id="dhcp6">
2261 e029943a Seth Mos
							<td colspan="2" style="padding: 0px;">
2262 168549b9 Colin Fleming
								<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="dhcp6">
2263 e029943a Seth Mos
									<tr>
2264 6e31ca39 N0YB
										<td colspan="2" valign="top" class="listtopic"><?=gettext("DHCP6 client configuration &nbsp; &nbsp; " .
2265
										' <input name="adv_dhcp6_config_advanced" type="checkbox" id="adv_dhcp6_config_advanced" value="" onclick="show_adv_dhcp6_config(this)" /> ' .
2266
										" Advanced &nbsp; &nbsp; " .
2267
										' <input name="adv_dhcp6_config_file_override" type="checkbox" id="adv_dhcp6_config_file_override" value="" onclick="show_adv_dhcp6_config(this)" /> ' .
2268
										" Config File Override &nbsp; &nbsp; "); ?>
2269 f4dd8b4c N0YB
										</td>
2270 ed395640 Seth Mos
									</tr>
2271 20a7cb15 smos
									<!--- Leave commented out for now
2272 6e31ca39 N0YB
									<tr style='display:none' id="basicdhcp6_show_dhcp6_duid">
2273 a9543eae Seth Mos
										<td width="22%" valign="top" class="vncell"><?=gettext("DHCPv6 Unique Identifier (DUID)"); ?></td>
2274
										<td width="78%" class="vtable">
2275 2cbe4b47 Colin Fleming
											<input name="dhcp6-duid" type="text" class="formfld unknown" id="dhcp6-duid" size="40" value="<?=htmlspecialchars($pconfig['dhcp6-duid']);?>" />
2276 8cd558b6 ayvis
											<br />
2277 a9543eae Seth Mos
											<?=gettext("The value in this field is sent as the DHCPv6 client identifier " .
2278 7149c4e7 Seth Mos
											"when requesting a DHCPv6 lease."); ?><br />
2279
											<?php	if(is_readable("/var/db/dhcp6c_duid")) {
2280 ed395640 Seth Mos
													// $current_duid = file_get_contents("/var/db/dhcp6c_duid");
2281 7149c4e7 Seth Mos
												}
2282 b1e4005f Vinicius Coque
												printf(gettext("The current DUID is: '%s'"),$current_duid);
2283 bfab2419 smos
												// hexdump -e '"%07.7_ax " 1/2 "%04x" " " 14/1 "%02x:" "\n"'
2284 7149c4e7 Seth Mos
											?>
2285
										</td>
2286
									</tr>
2287 20a7cb15 smos
									-->
2288 6e31ca39 N0YB
									<tr style='display:none' id="basicdhcp6_use_pppoeinterface">
2289 dbb4e089 Ermal
										<td width="22%" valign="top" class="vncell"><?=gettext("Use IPv4 connectivity as parent interface"); ?></td>
2290
										<td width="78%" class="vtable">
2291
											<input name="dhcp6usev4iface" type="checkbox" id="dhcp6usev4iface" value="yes" <?php if ($pconfig['dhcp6usev4iface'] == true) echo "checked=\"checked\""; ?> />
2292
											<?=gettext("Request a IPv6 prefix/information through the IPv4 connectivity link"); ?>
2293
										</td>
2294
									</tr>
2295 6e31ca39 N0YB
									<tr style='display:none' id="basicdhcp6_show_dhcp6_prefix_only">
2296 e829fcbb Chris Buechler
										<td width="22%" valign="top" class="vncell"><?=gettext("Request only an IPv6 prefix"); ?></td>
2297 a13acc0e smos
										<td width="78%" class="vtable">
2298 3b648a09 Phil Davis
											<input name="dhcp6prefixonly" type="checkbox" id="dhcp6prefixonly" value="yes" <?php if ($pconfig['dhcp6prefixonly'] == true) echo "checked=\"checked\""; ?> />
2299 e829fcbb Chris Buechler
											<?=gettext("Only request an IPv6 prefix, do not request an IPv6 address"); ?>
2300 a13acc0e smos
										</td>
2301
									</tr>
2302 6e31ca39 N0YB
									<tr style='display:none' id="basicdhcp6_show_dhcp6_prefix_delegation_size">
2303 7149c4e7 Seth Mos
										<td width="22%" valign="top" class="vncell"><?=gettext("DHCPv6 Prefix Delegation size"); ?></td>
2304
										<td width="78%" class="vtable">
2305 ed395640 Seth Mos
											<select name="dhcp6-ia-pd-len" class="formselect" id="dhcp6-ia-pd-len">
2306 7149c4e7 Seth Mos
												<?php
2307 ed395640 Seth Mos
												$sizes = array("none" => "None", 16 => "48", 12 => "52", 8 => "56", 4 => "60", 2 => "62", 1 => "63", 0 => "64");
2308 7149c4e7 Seth Mos
												foreach($sizes as $bits => $length) {
2309
													echo "<option value=\"{$bits}\" ";
2310 339d2743 Colin Fleming
													if (is_numeric($pconfig['dhcp6-ia-pd-len']) && ($bits == $pconfig['dhcp6-ia-pd-len'])) echo "selected=\"selected\"";
2311 7149c4e7 Seth Mos
													echo ">" . $length . "</option>";
2312
												}
2313
												?>
2314
											</select>
2315 8cd558b6 ayvis
											<br />
2316 ed395640 Seth Mos
											<?=gettext("The value in this field is the delegated prefix length provided by the DHCPv6 server. Normally specified by the ISP."); ?>
2317 30ade846 gnhb
										</td>
2318
									</tr>
2319 6e31ca39 N0YB
									<tr style='display:none' id="basicdhcp6_show_dhcp6_prefix_send_hint">
2320 18f3c2fd Daniel Becker
										<td width="22%" valign="top" class="vncell"><?=gettext("Send IPv6 prefix hint"); ?></td>
2321
										<td width="78%" class="vtable">
2322
											<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\""; ?> />
2323
											<?=gettext("Send an IPv6 prefix hint to indicate the desired prefix size for delegation"); ?>
2324
										</td>
2325
									</tr>
2326 f4dd8b4c N0YB
2327 6e31ca39 N0YB
									<tr style='display:none' id="show_adv_dhcp6_interface_statement">
2328 f4dd8b4c N0YB
										<td width="22%" valign="top" class="vncell">
2329 d82b2a6f k-paulius
											<?=gettext("<a target=\"FreeBSD_DHCP\" href=\"http://www.freebsd.org/cgi/man.cgi?query=dhcp6c.conf&amp;sektion=5&amp;apropos=0&amp;manpath=FreeBSD+10.1-RELEASE+and+Ports#Interface_statement\">Interface Statement</a>"); ?>
2330 8cd558b6 ayvis
											<br /><br />
2331 6e31ca39 N0YB
											<input name="adv_dhcp6_interface_statement_information_only_enable" type="checkbox" id="adv_dhcp6_interface_statement_information_only_enable" value="" onclick="show_adv_dhcp6_config(this)" />
2332 f4dd8b4c N0YB
											<?=gettext("Information Only"); ?>
2333
										</td>
2334
										<td width="78%" class="vtable">
2335 8cd558b6 ayvis
											<?=gettext("Send Options"); ?><br />
2336 6e31ca39 N0YB
											<input name="adv_dhcp6_interface_statement_send_options" type="text" class="formfld unknown" id="adv_dhcp6_interface_statement_send_options" size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp6_interface_statement_send_options']);?>" />
2337 8cd558b6 ayvis
											<br />
2338
											<?=gettext("The values in this field are DHCP send options to be sent when requesting a DHCP lease.  [option declaration [, ...]] <br />" .
2339
											"Value Substitutions: {interface}, {hostname}, {mac_addr_asciiCD}, {mac_addr_hexCD} <br />" .
2340
											"Where C is U(pper) or L(ower) Case, and D is \" :-.\" Delimiter (space, colon, hyphen, or period) (omitted for none). <br />" .
2341 f4dd8b4c N0YB
											"Some DHCP services may require certain options be or not be sent. "); ?>
2342 8cd558b6 ayvis
											<br />
2343
											<br />
2344
											<?=gettext("Request Options"); ?><br />
2345 6e31ca39 N0YB
											<input name="adv_dhcp6_interface_statement_request_options" type="text" class="formfld unknown" id="adv_dhcp6_interface_statement_request_options" size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp6_interface_statement_request_options']);?>" />
2346 8cd558b6 ayvis
											<br />
2347
											<?=gettext("The values in this field are DHCP request options to be sent when requesting a DHCP lease.  [option [, ...]] <br />" .
2348 f4dd8b4c N0YB
											"Some DHCP services may require certain options be or not be requested. "); ?>
2349 8cd558b6 ayvis
											<br />
2350
											<br />
2351
											<?=gettext("Script"); ?><br />
2352 6e31ca39 N0YB
											<input name="adv_dhcp6_interface_statement_script" type="text" class="formfld unknown" id="adv_dhcp6_interface_statement_script" size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp6_interface_statement_script']);?>" />
2353 8cd558b6 ayvis
											<br />
2354
											<?=gettext("The value in this field is the absolute path to a script invoked on certain conditions including when a reply message is received. <br />" .
2355 f4dd8b4c N0YB
											"[/[dirname/[.../]]filename[.ext]] "); ?>
2356
										</td>
2357
									</tr>
2358
2359 6e31ca39 N0YB
									<tr style='display:none' id="show_adv_dhcp6_id_assoc_statement">
2360 336d4f04 N0YB
										<td width="22%" valign="top" class="vncell">
2361 d82b2a6f k-paulius
											<?=gettext("<a target=\"FreeBSD_DHCP\" href=\"http://www.freebsd.org/cgi/man.cgi?query=dhcp6c.conf&amp;sektion=5&amp;apropos=0&amp;manpath=FreeBSD+10.1-RELEASE+and+Ports#Identity_association_statement\">Identity Association Statement</a>"); ?>
2362 336d4f04 N0YB
										</td>
2363 f4dd8b4c N0YB
										<td width="78%" class="vtable">
2364
2365 ce668fcd Colin Fleming
											<input name="adv_dhcp6_id_assoc_statement_address_enable" type="checkbox" id="adv_dhcp6_id_assoc_statement_address_enable" value="" onclick="show_adv_dhcp6_config(this);" />
2366 f4dd8b4c N0YB
											<?=gettext("Non-Temporary Address Allocation"); ?>
2367 6e31ca39 N0YB
											<div style='display:none'  id="show_adv_dhcp6_id_assoc_statement_address">
2368 f4dd8b4c N0YB
											<?=gettext("id-assoc na"); ?>
2369
											<?=gettext("<i>ID</i>"); ?>
2370 6e31ca39 N0YB
											<input name="adv_dhcp6_id_assoc_statement_address_id" type="text" class="formfld unknown" id="adv_dhcp6_id_assoc_statement_address_id" size="3" value="<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_address_id']);?>" />
2371 8cd558b6 ayvis
											<br />
2372 f4dd8b4c N0YB
											<?=gettext("Address"); ?>
2373
											<?=gettext("<i>ipv6-address</i>"); ?>
2374 6e31ca39 N0YB
											<input name="adv_dhcp6_id_assoc_statement_address" type="text" class="formfld unknown" id="adv_dhcp6_id_assoc_statement_address" size="34" value="<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_address']);?>" />
2375 f4dd8b4c N0YB
											<?=gettext("<i>pltime</i>"); ?>
2376 6e31ca39 N0YB
											<input name="adv_dhcp6_id_assoc_statement_address_pltime" type="text" class="formfld unknown" id="adv_dhcp6_id_assoc_statement_address_pltime" size="3" value="<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_address_pltime']);?>" />
2377 f4dd8b4c N0YB
											<?=gettext("<i>vltime</i>"); ?>
2378 6e31ca39 N0YB
											<input name="adv_dhcp6_id_assoc_statement_address_vltime" type="text" class="formfld unknown" id="adv_dhcp6_id_assoc_statement_address_vltime" size="3" value="<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_address_vltime']);?>" />
2379 f4dd8b4c N0YB
											</div>
2380 6e31ca39 N0YB
											<hr/>
2381 f4dd8b4c N0YB
2382 6e31ca39 N0YB
											<input name="adv_dhcp6_id_assoc_statement_prefix_enable" type="checkbox" id="adv_dhcp6_id_assoc_statement_prefix_enable" value="" onclick="show_adv_dhcp6_config(this)" />
2383 f4dd8b4c N0YB
											<?=gettext("Prefix Delegation"); ?>
2384 6e31ca39 N0YB
											<div style='display:none'  id="show_adv_dhcp6_id_assoc_statement_prefix">
2385 f4dd8b4c N0YB
											<?=gettext("id-assoc pd"); ?>
2386
											<?=gettext("<i>ID</i>"); ?>
2387 6e31ca39 N0YB
											<input name="adv_dhcp6_id_assoc_statement_prefix_id" type="text" class="formfld unknown" id="adv_dhcp6_id_assoc_statement_prefix_id" size="3" value="<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_prefix_id']);?>" />
2388 8cd558b6 ayvis
											<br />
2389 f4dd8b4c N0YB
											<?=gettext("Prefix"); ?>
2390
											<?=gettext("<i>ipv6-prefix</i>"); ?>
2391 6e31ca39 N0YB
											<input name="adv_dhcp6_id_assoc_statement_prefix" type="text" class="formfld unknown" id="adv_dhcp6_id_assoc_statement_prefix" size="37" value="<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_prefix']);?>" />
2392 f4dd8b4c N0YB
											<?=gettext("<i>pltime</i>"); ?>
2393 6e31ca39 N0YB
											<input name="adv_dhcp6_id_assoc_statement_prefix_pltime" type="text" class="formfld unknown" id="adv_dhcp6_id_assoc_statement_prefix_pltime" size="3" value="<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_prefix_pltime']);?>" />
2394 f4dd8b4c N0YB
											<?=gettext("<i>vltime</i>"); ?>
2395 6e31ca39 N0YB
											<input name="adv_dhcp6_id_assoc_statement_prefix_vltime" type="text" class="formfld unknown" id="adv_dhcp6_id_assoc_statement_prefix_vltime" size="3" value="<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_prefix_vltime']);?>" />
2396 f4dd8b4c N0YB
											</div>
2397
										</td>
2398
									</tr>
2399
2400 6e31ca39 N0YB
									<tr style='display:none' id="show_adv_dhcp6_prefix_interface_statement">
2401 336d4f04 N0YB
										<td width="22%" valign="top" class="vncell">
2402 d82b2a6f k-paulius
											<?=gettext("<a target=\"FreeBSD_DHCP\" href=\"http://www.freebsd.org/cgi/man.cgi?query=dhcp6c.conf&amp;sektion=5&amp;apropos=0&amp;manpath=FreeBSD+10.1-RELEASE+and+Ports#Prefix_interface_statement\">Prefix Interface Statement</a>"); ?>
2403 336d4f04 N0YB
										</td>
2404 f4dd8b4c N0YB
										<td width="78%" class="vtable">
2405
											<?=gettext("Prefix Interface "); ?>
2406
											<?=gettext("<i>sla-id</i>"); ?>
2407 6e31ca39 N0YB
											<input name="adv_dhcp6_prefix_interface_statement_sla_id" type="text" class="formfld unknown" id="adv_dhcp6_prefix_interface_statement_sla_id" size="3" value="<?=htmlspecialchars($pconfig['adv_dhcp6_prefix_interface_statement_sla_id']);?>" />
2408 f4dd8b4c N0YB
											<?=gettext("<i>sla-len</i>"); ?>
2409 6e31ca39 N0YB
											<input name="adv_dhcp6_prefix_interface_statement_sla_len" type="text" class="formfld unknown" id="adv_dhcp6_prefix_interface_statement_sla_len" size="3" value="<?=htmlspecialchars($pconfig['adv_dhcp6_prefix_interface_statement_sla_len']);?>" />
2410 f4dd8b4c N0YB
										</td>
2411 a236affe N0YB
									</tr>
2412 f4dd8b4c N0YB
2413 6e31ca39 N0YB
									<tr style='display:none' id="show_adv_dhcp6_authentication_statement">
2414 336d4f04 N0YB
										<td width="22%" valign="top" class="vncell">
2415 d82b2a6f k-paulius
											<?=gettext("<a target=\"FreeBSD_DHCP\" href=\"http://www.freebsd.org/cgi/man.cgi?query=dhcp6c.conf&amp;sektion=5&amp;apropos=0&amp;manpath=FreeBSD+10.1-RELEASE+and+Ports#Authentication_statement\">Authentication Statement</a>"); ?>
2416 336d4f04 N0YB
										</td>
2417 f4dd8b4c N0YB
										<td width="78%" class="vtable">
2418
											<?=gettext("<i>authname</i>"); ?>
2419 6e31ca39 N0YB
											<input name="adv_dhcp6_authentication_statement_authname" type="text" class="formfld unknown" id="adv_dhcp6_authentication_statement_authname" size="10" value="<?=htmlspecialchars($pconfig['adv_dhcp6_authentication_statement_authname']);?>" />
2420 f4dd8b4c N0YB
											<?=gettext("<i>protocol</i>"); ?>
2421 6e31ca39 N0YB
											<input name="adv_dhcp6_authentication_statement_protocol" type="text" class="formfld unknown" id="adv_dhcp6_authentication_statement_protocol" size="6" value="<?=htmlspecialchars($pconfig['adv_dhcp6_authentication_statement_protocol']);?>" />
2422 f4dd8b4c N0YB
											<?=gettext("<i>algorithm</i>"); ?>
2423 6e31ca39 N0YB
											<input name="adv_dhcp6_authentication_statement_algorithm" type="text" class="formfld unknown" id="adv_dhcp6_authentication_statement_algorithm" size="8" value="<?=htmlspecialchars($pconfig['adv_dhcp6_authentication_statement_algorithm']);?>" />
2424 f4dd8b4c N0YB
											<?=gettext("<i>rdm</i>"); ?>
2425 6e31ca39 N0YB
											<input name="adv_dhcp6_authentication_statement_rdm" type="text" class="formfld unknown" id="adv_dhcp6_authentication_statement_rdm" size="9" value="<?=htmlspecialchars($pconfig['adv_dhcp6_authentication_statement_rdm']);?>" />
2426 f4dd8b4c N0YB
										</td>
2427
									</tr>
2428
2429 6e31ca39 N0YB
									<tr style='display:none' id="show_adv_dhcp6_key_info_statement">
2430 336d4f04 N0YB
										<td width="22%" valign="top" class="vncell">
2431 d82b2a6f k-paulius
											<?=gettext("<a target=\"FreeBSD_DHCP\" href=\"http://www.freebsd.org/cgi/man.cgi?query=dhcp6c.conf&amp;sektion=5&amp;apropos=0&amp;manpath=FreeBSD+10.1-RELEASE+and+Ports#Keyinfo_statement\">Keyinfo Statement</a>"); ?>
2432 336d4f04 N0YB
										</td>
2433 f4dd8b4c N0YB
										<td width="78%" class="vtable">
2434
											<?=gettext("<i>keyname</i>"); ?>
2435 6e31ca39 N0YB
											<input name="adv_dhcp6_key_info_statement_keyname" type="text" class="formfld unknown" id="adv_dhcp6_key_info_statement_keyname" size="27" value="<?=htmlspecialchars($pconfig['adv_dhcp6_key_info_statement_keyname']);?>" />
2436 f4dd8b4c N0YB
											<?=gettext("<i>realm</i>"); ?>
2437 6e31ca39 N0YB
											<input name="adv_dhcp6_key_info_statement_realm" type="text" class="formfld unknown" id="adv_dhcp6_key_info_statement_realm" size="37" value="<?=htmlspecialchars($pconfig['adv_dhcp6_key_info_statement_realm']);?>" />
2438 8cd558b6 ayvis
											<br />
2439 f4dd8b4c N0YB
											<?=gettext("<i>keyid</i>"); ?>
2440 6e31ca39 N0YB
											<input name="adv_dhcp6_key_info_statement_keyid" type="text" class="formfld unknown" id="adv_dhcp6_key_info_statement_keyid" size="2" value="<?=htmlspecialchars($pconfig['adv_dhcp6_key_info_statement_keyid']);?>" />
2441 f4dd8b4c N0YB
											<?=gettext("<i>secret</i>"); ?>
2442 6e31ca39 N0YB
											<input name="adv_dhcp6_key_info_statement_secret" type="text" class="formfld unknown" id="adv_dhcp6_key_info_statement_secret" size="36" value="<?=htmlspecialchars($pconfig['adv_dhcp6_key_info_statement_secret']);?>" />
2443 f4dd8b4c N0YB
											<?=gettext("<i>expire</i>"); ?>
2444 6e31ca39 N0YB
											<input name="adv_dhcp6_key_info_statement_expire" type="text" class="formfld unknown" id="adv_dhcp6_key_info_statement_expire" size="15" value="<?=htmlspecialchars($pconfig['adv_dhcp6_key_info_statement_expire']);?>" />
2445 f4dd8b4c N0YB
										</td>
2446 a236affe N0YB
									</tr>
2447 f4dd8b4c N0YB
2448 6e31ca39 N0YB
									<tr style='display:none' id="show_adv_dhcp6_config_file_override">
2449 336d4f04 N0YB
										<td width="22%" valign="top" class="vncell">
2450 d82b2a6f k-paulius
											<?=gettext("<a target=\"FreeBSD_DHCP\" href=\"http://www.freebsd.org/cgi/man.cgi?query=dhcp6c.conf&amp;sektion=5&amp;apropos=0&amp;manpath=FreeBSD+10.1-RELEASE+and+Ports\">Configuration File</a> Override"); ?>
2451 336d4f04 N0YB
										</td>
2452 f4dd8b4c N0YB
										<td width="78%" class="vtable">
2453 6e31ca39 N0YB
 											<input name="adv_dhcp6_config_file_override_path"   type="text" class="formfld unknown" id="adv_dhcp6_config_file_override_path"  size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp6_config_file_override_path']);?>" />
2454 8cd558b6 ayvis
											<br />
2455
											<?=gettext("The value in this field is the full absolute path to a DHCP client configuration file.  [/[dirname/[.../]]filename[.ext]] <br /> " .
2456
											"Value Substitutions in Config File: {interface}, {hostname}, {mac_addr_asciiCD}, {mac_addr_hexCD} <br />" .
2457
											"Where C is U(pper) or L(ower) Case, and D is \" :-.\" Delimiter (space, colon, hyphen, or period) (omitted for none). <br />" .
2458 f4dd8b4c N0YB
											"Some ISPs may require certain options be or not be sent. "); ?>
2459
										</td>
2460
									</tr>
2461
2462
 									<tr>
2463
 										<td colspan="2" valign="top" height="16"></td>
2464
 									</tr>
2465
2466 6e31ca39 N0YB
								</table>
2467
2468 f4dd8b4c N0YB
									<script type="text/javascript">
2469 6e31ca39 N0YB
									//<![CDATA[
2470 f4dd8b4c N0YB
										function show_adv_dhcp6_config(T) {
2471
2472
											if (T.checked) T.value = "Selected";
2473
											else T.value = "";
2474
2475
											     if (document.iform.adv_dhcp6_config_file_override.checked)	show_hide_adv_dhcp6('none', 'none', ''    );
2476
											else if (document.iform.adv_dhcp6_config_advanced.checked)		show_hide_adv_dhcp6('none', '',     'none');
2477
											else 															show_hide_adv_dhcp6('',     'none', 'none');
2478
										}
2479
2480
										function show_hide_adv_dhcp6(basic, advanced, override) {
2481
2482 dbb4e089 Ermal
											document.getElementById("basicdhcp6_use_pppoeinterface").style.display = basic;
2483 f4dd8b4c N0YB
											document.getElementById("basicdhcp6_show_dhcp6_prefix_delegation_size").style.display = basic;
2484 18f3c2fd Daniel Becker
											document.getElementById("basicdhcp6_show_dhcp6_prefix_send_hint").style.display = basic;
2485 a13acc0e smos
											document.getElementById("basicdhcp6_show_dhcp6_prefix_only").style.display = basic;
2486 f4dd8b4c N0YB
2487
											document.getElementById("show_adv_dhcp6_interface_statement").style.display = advanced;
2488
											document.getElementById("show_adv_dhcp6_id_assoc_statement").style.display = advanced;
2489
2490
											document.getElementById("show_adv_dhcp6_id_assoc_statement_address").style.display = 'none';
2491
											if (document.iform.adv_dhcp6_id_assoc_statement_address_enable.checked)  {
2492
												document.getElementById("show_adv_dhcp6_id_assoc_statement_address").style.display = advanced;
2493
											}
2494
2495
											document.getElementById("show_adv_dhcp6_id_assoc_statement_prefix").style.display = 'none';
2496
											document.getElementById("show_adv_dhcp6_prefix_interface_statement").style.display = 'none';
2497
											if (document.iform.adv_dhcp6_id_assoc_statement_prefix_enable.checked)  {
2498
												document.getElementById("show_adv_dhcp6_id_assoc_statement_prefix").style.display = advanced;
2499
												document.getElementById("show_adv_dhcp6_prefix_interface_statement").style.display = advanced;
2500
											}
2501
2502
											document.getElementById("show_adv_dhcp6_authentication_statement").style.display = advanced;
2503
											document.getElementById("show_adv_dhcp6_key_info_statement").style.display = advanced;
2504
2505
											document.getElementById("show_adv_dhcp6_config_file_override").style.display = override;
2506
										}
2507
2508
										<!-- Set the adv_dhcp6_config_advanced checkbox from saved config -->
2509
										if ("<?=htmlspecialchars($pconfig['adv_dhcp6_config_advanced']);?>" == "Selected") document.iform.adv_dhcp6_config_advanced.checked = true;
2510
										show_adv_dhcp6_config(document.iform.adv_dhcp6_config_advanced);
2511
2512
										<!-- Set the adv_dhcp6_config_file_override checkbox from saved config -->
2513
										if ("<?=htmlspecialchars($pconfig['adv_dhcp6_config_file_override']);?>" == "Selected") document.iform.adv_dhcp6_config_file_override.checked = true;
2514
										show_adv_dhcp6_config(document.iform.adv_dhcp6_config_file_override);
2515
2516
										<!-- Set the adv_dhcp6_interface_statement_information_only_enable checkbox from saved config -->
2517
										if ("<?=htmlspecialchars($pconfig['adv_dhcp6_interface_statement_information_only_enable']);?>" == "Selected") document.iform.adv_dhcp6_interface_statement_information_only_enable.checked = true;
2518
										show_adv_dhcp6_config(document.iform.adv_dhcp6_interface_statement_information_only_enable);
2519
2520
										<!-- Set the adv_dhcp6_id_assoc_statement_address_enable checkbox from saved config -->
2521
										if ("<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_address_enable']);?>" == "Selected") document.iform.adv_dhcp6_id_assoc_statement_address_enable.checked = true;
2522
										show_adv_dhcp6_config(document.iform.adv_dhcp6_id_assoc_statement_address_enable);
2523
2524
										<!-- Set the adv_dhcp6_id_assoc_statement_prefix_enable checkbox from saved config -->
2525
										if ("<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_prefix_enable']);?>" == "Selected") document.iform.adv_dhcp6_id_assoc_statement_prefix_enable.checked = true;
2526
										show_adv_dhcp6_config(document.iform.adv_dhcp6_id_assoc_statement_prefix_enable);
2527 6e31ca39 N0YB
									//]]>
2528 f4dd8b4c N0YB
									</script>
2529
2530 47593ac6 Seth Mos
							</td>
2531
						</tr>
2532 6e31ca39 N0YB
						<tr style="display:none;" id="_6rd">
2533 7d567088 smos
							<td colspan="2" style="padding: 0px;">
2534 168549b9 Colin Fleming
								<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="6rd">
2535 7d567088 smos
									<tr>
2536 63d129cc Chris Buechler
										<td colspan="2" valign="top" class="listtopic"><?=gettext("6RD Configuration"); ?></td>
2537 7d567088 smos
									</tr>
2538
									<tr>
2539
										<td width="22%" valign="top" class="vncell"><?=gettext("6RD prefix"); ?></td>
2540
										<td width="78%" class="vtable">
2541 2cbe4b47 Colin Fleming
											<input name="prefix-6rd" type="text" class="formfld unknown" id="prefix-6rd" size="40" value="<?=htmlspecialchars($pconfig['prefix-6rd']);?>" />
2542 8cd558b6 ayvis
											<br />
2543 32dc8109 smos
											<?=gettext("The value in this field is the 6RD IPv6 prefix assigned by your ISP. e.g. '2001:db8::/32'") ?><br />
2544 7d567088 smos
										</td>
2545
									</tr>
2546
									<tr>
2547 12215bfb smos
										<td width="22%" valign="top" class="vncell"><?=gettext("6RD Border Relay"); ?></td>
2548 7d567088 smos
										<td width="78%" class="vtable">
2549 2cbe4b47 Colin Fleming
											<input name="gateway-6rd" type="text" class="formfld unknown" id="gateway-6rd" size="40" value="<?=htmlspecialchars($pconfig['gateway-6rd']);?>" />
2550 8cd558b6 ayvis
											<br />
2551 32dc8109 smos
											<?=gettext("The value in this field is 6RD IPv4 gateway address assigned by your ISP") ?><br />
2552 7d567088 smos
										</td>
2553
									</tr>
2554
									<tr>
2555 12215bfb smos
										<td width="22%" valign="top" class="vncell"><?=gettext("6RD IPv4 Prefix length"); ?></td>
2556 7d567088 smos
										<td width="78%" class="vtable">
2557 12215bfb smos
											<select name="prefix-6rd-v4plen" class="formselect" id="prefix-6rd-v4plen">
2558 7d567088 smos
												<?php
2559 12215bfb smos
												for ($i = 0; $i < 32; $i++) {
2560
													echo "<option value=\"{$i}\" ";
2561 339d2743 Colin Fleming
													if (is_numeric($pconfig['prefix-6rd-v4plen']) && ($i == $pconfig['prefix-6rd-v4plen'])) echo "selected=\"selected\"";
2562 12215bfb smos
													echo ">" . $i . " bits</option>";
2563 7d567088 smos
												}
2564
												?>
2565
											</select>
2566 8cd558b6 ayvis
											<br />
2567 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."); ?>
2568 7d567088 smos
										</td>
2569
									</tr>
2570 a236affe N0YB
									<tr>
2571
										<td colspan="2" valign="top" height="16"></td>
2572
									</tr>
2573 7d567088 smos
								</table>
2574
							</td>
2575
						</tr>
2576 6e31ca39 N0YB
						<tr style="display:none;" id="track6">
2577 20a7cb15 smos
							<td colspan="2" style="padding: 0px;">
2578 168549b9 Colin Fleming
								<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="track6">
2579 20a7cb15 smos
									<tr>
2580
										<td colspan="2" valign="top" class="listtopic"><?=gettext("Track IPv6 Interface"); ?></td>
2581
									</tr>
2582
									<tr>
2583
										<td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Interface"); ?></td>
2584
										<td width="78%" class="vtable">
2585 986fd3d9 Renato Botelho
										<select name="track6-interface" id='track6-interface' class='formselect' onchange="update_track6_prefix();">
2586 6d529efd Renato Botelho
										<?php
2587 20a7cb15 smos
											$interfaces = get_configured_interface_with_descr(false, true);
2588
											$dynv6ifs = array();
2589
											foreach ($interfaces as $iface => $ifacename) {
2590
												switch($config['interfaces'][$iface]['ipaddrv6']) {
2591
													case "6to4":
2592
													case "6rd":
2593
													case "dhcp6":
2594 986fd3d9 Renato Botelho
														$dynv6ifs[$iface] = array(
2595
															'name' => $ifacename,
2596
															'ipv6_num_prefix_ids' => pow(2, calculate_ipv6_delegation_length($iface)) - 1
2597
														);
2598 20a7cb15 smos
														break;
2599
													default:
2600
														continue;
2601
												}
2602
											}
2603 6e31ca39 N0YB
											$rowIndex = 0;
2604 986fd3d9 Renato Botelho
											foreach($dynv6ifs as $iface => $ifacedata) {
2605 6e31ca39 N0YB
												$rowIndex++;
2606 20a7cb15 smos
												echo "<option value=\"{$iface}\"";
2607
												if ($iface == $pconfig['track6-interface'])
2608 339d2743 Colin Fleming
													echo " selected=\"selected\"";
2609 986fd3d9 Renato Botelho
												echo ">" . htmlspecialchars($ifacedata['name']) . "</option>";
2610 20a7cb15 smos
											}
2611 6e31ca39 N0YB
											if ($rowIndex == 0)
2612
												echo "<option></option>";
2613 6d529efd Renato Botelho
										?>
2614 8cd558b6 ayvis
										</select> <br />
2615 986fd3d9 Renato Botelho
										<?php
2616
											foreach($dynv6ifs as $iface => $ifacedata) {
2617
												echo "<input type=\"hidden\" name=\"ipv6-num-prefix-ids-{$iface}\" id=\"ipv6-num-prefix-ids-{$iface}\" value=\"{$ifacedata['ipv6_num_prefix_ids']}\">\n";
2618
											}
2619
										?>
2620 8cd558b6 ayvis
											<br />
2621 20a7cb15 smos
											<?=gettext("This selects the dynamic IPv6 WAN interface to track for configuration") ?><br />
2622
										</td>
2623
									</tr>
2624
									<tr>
2625
										<td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Prefix ID"); ?></td>
2626
										<td width="78%" class="vtable">
2627 6b2d4b5a Darren Embry
											<?php
2628 02203e6d Renato Botelho
												if ($pconfig['track6-prefix-id'] == "")
2629
													$pconfig['track6-prefix-id'] = 0;
2630
												$track6_prefix_id_hex = sprintf("%x", $pconfig['track6-prefix-id']);
2631 6b2d4b5a Darren Embry
											?>
2632
											<input name="track6-prefix-id--hex" type="text" class="formfld unknown" id="track6-prefix-id--hex" size="8" value="<?= $track6_prefix_id_hex ?>" />
2633 986fd3d9 Renato Botelho
											<span id="track6-prefix-id-range"></span>
2634
											<input type="hidden" id="track6-prefix-id-max" value="0"></input>
2635 6b2d4b5a Darren Embry
											<br />
2636 b25ccd04 Chris Buechler
											<?= gettext("The value in this field is the (Delegated) IPv6 prefix ID. This determines the configurable network ID based on the dynamic IPv6 connection"); ?>
2637 6b2d4b5a Darren Embry
											<br />
2638 986fd3d9 Renato Botelho
											<?= gettext("default value is 0."); ?>
2639 20a7cb15 smos
										</td>
2640
									</tr>
2641 a236affe N0YB
									<tr>
2642
										<td colspan="2" valign="top" height="16"></td>
2643
									</tr>
2644 20a7cb15 smos
								</table>
2645
							</td>
2646
						</tr>
2647 6e31ca39 N0YB
						<tr style="display:none;" id="ppp">
2648 6c05cfb0 gnhb
							<td colspan="2" style="padding: 0px;">
2649 168549b9 Colin Fleming
								<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="ppp">
2650 6c05cfb0 gnhb
									<tr>
2651 136c598d Carlos Eduardo Ramos
										<td colspan="2" valign="top" class="listtopic"><?=gettext("PPP configuration"); ?></td>
2652 6c05cfb0 gnhb
									</tr>
2653 6e31ca39 N0YB
									<tr id="ppp_provider">
2654 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Service Provider"); ?></td>
2655 3a906378 gnhb
										<td width="78%" class="vtable">
2656 168549b9 Colin Fleming
											<table border="0" cellpadding="0" cellspacing="0" summary="service provider">
2657 3a906378 gnhb
												<tr id="trcountry">
2658 933ea015 Carlos Eduardo Ramos
													<td><?=gettext("Country:"); ?> &nbsp;&nbsp;</td>
2659 3a906378 gnhb
													<td>
2660 32b91bcf Colin Fleming
														<select class="formselect" name="country" id="country" onchange="providers_list()">
2661 3a906378 gnhb
															<option></option>
2662
														</select>
2663
													</td>
2664
												</tr>
2665
												<tr id="trprovider" style="display:none">
2666 933ea015 Carlos Eduardo Ramos
													<td><?=gettext("Provider:"); ?> &nbsp;&nbsp;</td>
2667 3a906378 gnhb
													<td>
2668 4a2c47fe N0YB
														<select class="formselect" name="provider_list" id="provider_list" onchange="providerplan_list()">
2669 3a906378 gnhb
															<option></option>
2670
														</select>
2671
													</td>
2672
												</tr>
2673
												<tr id="trproviderplan" style="display:none">
2674 933ea015 Carlos Eduardo Ramos
													<td><?=gettext("Plan:"); ?> &nbsp;&nbsp;</td>
2675 3a906378 gnhb
													<td>
2676 32b91bcf Colin Fleming
														<select class="formselect" name="providerplan" id="providerplan" onchange="prefill_provider()">
2677 3a906378 gnhb
															<option></option>
2678
														</select>
2679
													</td>
2680
												</tr>
2681
											</table>
2682 8cd558b6 ayvis
											<br /><span class="vexpl"><?=gettext("Select to fill in data for your service provider."); ?></span>
2683 3a906378 gnhb
										</td>
2684
									</tr>
2685 6c05cfb0 gnhb
									<tr>
2686 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Username"); ?></td>
2687 3a906378 gnhb
										<td width="78%" class="vtable">
2688 67877234 Phil Davis
										<input name="ppp_username" type="text" class="formfld user" id="ppp_username" size="20" value="<?=htmlspecialchars($pconfig['ppp_username']);?>" />
2689 3a906378 gnhb
										</td>
2690
									</tr>
2691
									<tr>
2692 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Password"); ?></td>
2693 3a906378 gnhb
										<td width="78%" class="vtable">
2694 67877234 Phil Davis
										<input name="ppp_password" type="password" class="formfld pwd" id="ppp_password" size="20" value="<?=htmlspecialchars($pconfig['ppp_password']);?>" />
2695 3a906378 gnhb
										</td>
2696
									</tr>
2697 6e31ca39 N0YB
									<tr id="phone_num">
2698 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Phone Number"); ?></td>
2699 3a906378 gnhb
										<td width="78%" class="vtable">
2700 2cbe4b47 Colin Fleming
											<input name="phone" type="text" class="formfld unknown" id="phone" size="12" value="<?=htmlspecialchars($pconfig['phone']);?>" />
2701 3a906378 gnhb
										</td>
2702
									</tr>
2703 6e31ca39 N0YB
									<tr id="apn_">
2704 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Access Point Name (APN)"); ?></td>
2705 3a906378 gnhb
										<td width="78%" class="vtable">
2706 2cbe4b47 Colin Fleming
											<input name="apn" type="text" class="formfld unknown" id="apn" size="40" value="<?=htmlspecialchars($pconfig['apn']);?>" />
2707 3a906378 gnhb
										</td>
2708
									</tr>
2709 6e31ca39 N0YB
									<tr id="interface" >
2710 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Modem Port"); ?></td>
2711 3a906378 gnhb
										<td width="78%" class="vtable">
2712
											<select name="port" id="port" class="formselect">
2713
											<?php
2714
												$portlist = glob("/dev/cua*");
2715
												$modems = glob("/dev/modem*");
2716
												$portlist = array_merge($portlist, $modems);
2717 6e31ca39 N0YB
												$rowIndex = 0;
2718 3a906378 gnhb
												foreach ($portlist as $port) {
2719
													if(preg_match("/\.(lock|init)$/", $port))
2720
														continue;
2721 6e31ca39 N0YB
													$rowIndex++;
2722 3a906378 gnhb
													echo "<option value=\"".trim($port)."\"";
2723
													if ($pconfig['port'] == $port)
2724 339d2743 Colin Fleming
														echo " selected=\"selected\"";
2725 3a906378 gnhb
													echo ">{$port}</option>";
2726 6e31ca39 N0YB
												}
2727
												if ($rowIndex == 0)
2728
													echo "<option></option>";
2729
												?>
2730 3a906378 gnhb
											</select>
2731
										</td>
2732
									</tr>
2733 168549b9 Colin Fleming
									<tr>
2734 136c598d Carlos Eduardo Ramos
									<td width="22%" valign="top" class="vncell"><?=gettext("Advanced PPP"); ?></td>
2735 6c05cfb0 gnhb
										<?php if (isset($pconfig['pppid'])): ?>
2736
											<td width="78%" class="vtable">
2737 933ea015 Carlos Eduardo Ramos
											<a href="/interfaces_ppps_edit.php?id=<?=htmlspecialchars($pconfig['pppid']);?>" class="navlnk"><?=gettext("Click here"); ?> </a>
2738
											<?=gettext("to edit PPP configuration."); ?>
2739 6c05cfb0 gnhb
											</td>
2740 ee9933b6 Renato Botelho
										<?php else: ?>
2741 6c05cfb0 gnhb
											<td width="78%" class="vtable">
2742 933ea015 Carlos Eduardo Ramos
											<a href="/interfaces_ppps_edit.php" class="navlnk"><?=gettext("Click here"); ?> </a>
2743
											<?=gettext("to create a PPP configuration."); ?>
2744 6c05cfb0 gnhb
											</td>
2745 c0948c6c Renato Botelho
										<?php endif; ?>
2746 6c05cfb0 gnhb
									</tr>
2747 a236affe N0YB
									<tr>
2748
										<td colspan="2" valign="top" height="16"></td>
2749
									</tr>
2750 6c05cfb0 gnhb
								</table>
2751
							</td>
2752
						</tr>
2753 6e31ca39 N0YB
						<tr style="display:none;" id="pppoe">
2754 30ade846 gnhb
							<td colspan="2" style="padding:0px;">
2755 168549b9 Colin Fleming
								<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="pppoe">
2756 30ade846 gnhb
									<tr>
2757 136c598d Carlos Eduardo Ramos
										<td colspan="2" valign="top" class="listtopic"><?=gettext("PPPoE configuration"); ?></td>
2758 30ade846 gnhb
									</tr>
2759
									<tr>
2760 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Username"); ?></td>
2761 30ade846 gnhb
										<td width="78%" class="vtable">
2762 2cbe4b47 Colin Fleming
												<input name="pppoe_username" type="text" class="formfld user" id="pppoe_username" size="20" value="<?=htmlspecialchars($pconfig['pppoe_username']);?>" />
2763 30ade846 gnhb
										</td>
2764
									</tr>
2765
									<tr>
2766 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Password"); ?></td>
2767 30ade846 gnhb
										<td width="78%" class="vtable">
2768 2cbe4b47 Colin Fleming
											<input name="pppoe_password" type="password" class="formfld pwd" id="pppoe_password" size="20" value="<?=htmlspecialchars($pconfig['pppoe_password']);?>" />
2769 30ade846 gnhb
										</td>
2770
									</tr>
2771
									<tr>
2772 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Service name"); ?></td>
2773 2cbe4b47 Colin Fleming
										<td width="78%" class="vtable"><input name="provider" type="text" class="formfld unknown" id="provider" size="20" value="<?=htmlspecialchars($pconfig['provider']);?>" />
2774 8cd558b6 ayvis
											<br /> <span class="vexpl"><?=gettext("Hint: this field can usually be left empty"); ?></span>
2775 30ade846 gnhb
										</td>
2776
									</tr>
2777
									<tr>
2778 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Dial on demand"); ?></td>
2779 30ade846 gnhb
										<td width="78%" class="vtable">
2780 339d2743 Colin Fleming
											<input name="pppoe_dialondemand" type="checkbox" id="pppoe_dialondemand" value="enable" <?php if ($pconfig['pppoe_dialondemand']) echo "checked=\"checked\""; ?> />
2781 8cd558b6 ayvis
											<strong><?=gettext("Enable Dial-On-Demand mode"); ?></strong><br />
2782 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."); ?>
2783 30ade846 gnhb
										</td>
2784
									</tr>
2785
									<tr>
2786 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Idle timeout"); ?></td>
2787 30ade846 gnhb
										<td width="78%" class="vtable">
2788 8cd558b6 ayvis
											<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."); ?>
2789 30ade846 gnhb
										</td>
2790
									</tr>
2791
									<tr>
2792
										<td width="22%" valign="top" class="vncell"><?=gettext("Periodic reset");?></td>
2793
										<td width="78%" class="vtable">
2794 168549b9 Colin Fleming
											<table id="presetwrap" cellspacing="0" cellpadding="0" width="100%" summary="periodic reset">
2795 30ade846 gnhb
												<tr>
2796
													<td align="left" valign="top">
2797
														<p style="margin: 4px; padding: 4px 0 4px 0; width: 94%;">
2798 168549b9 Colin Fleming
														<select style="vertical-align:top" id="reset_type" name="pppoe-reset-type" class="formselect" onchange="show_reset_settings(this.value);">
2799 339d2743 Colin Fleming
															<option value=""><?=gettext("Disabled"); ?></option>
2800
															<option value="custom" <?php if ($pconfig['pppoe-reset-type'] == "custom") echo "selected=\"selected\""; ?>><?=gettext("Custom"); ?></option>
2801
															<option value="preset" <?php if ($pconfig['pppoe-reset-type'] == "preset") echo "selected=\"selected\""; ?>><?=gettext("Pre-Set"); ?></option>
2802 136c598d Carlos Eduardo Ramos
														</select> <?=gettext("Select a reset timing type"); ?>
2803 30ade846 gnhb
														</p>
2804
														<?php if ($pconfig['pppoe_pr_custom']): ?>
2805
															<p style="margin: 2px; padding: 4px; width: 94%;" id="pppoecustomwrap">
2806
														<?php else: ?>
2807
															<p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoecustomwrap">
2808
														<?php endif; ?>
2809 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" />
2810 136c598d Carlos Eduardo Ramos
														<?=gettext("hour (0-23)"); ?><br />
2811 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" />
2812 136c598d Carlos Eduardo Ramos
														<?=gettext("minute (0-59)"); ?><br />
2813 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']);?>" />
2814 136c598d Carlos Eduardo Ramos
														<?=gettext("reset at a specific date (mm/dd/yyyy)"); ?>
2815 30ade846 gnhb
														<br />&nbsp;<br />
2816 933ea015 Carlos Eduardo Ramos
														<span class="red"><strong><?=gettext("Note:"); ?> </strong></span>
2817 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."); ?>
2818 30ade846 gnhb
														</p>
2819
														<?php if ($pconfig['pppoe_pr_preset']): ?>
2820
															<p style="margin: 2px; padding: 4px; width: 94%;" id="pppoepresetwrap">
2821
														<?php else: ?>
2822
															<p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoepresetwrap">
2823
														<?php endif; ?>
2824 c0948c6c Renato Botelho
														<input name="pppoe_pr_preset_val" type="radio" id="pppoe_monthly" value="monthly" <?php if ($pconfig['pppoe_monthly']) echo "checked=\"checked\""; ?> />
2825 136c598d Carlos Eduardo Ramos
														<?=gettext("reset at each month ('0 0 1 * *')"); ?>
2826 30ade846 gnhb
														<br />
2827 c0948c6c Renato Botelho
														<input name="pppoe_pr_preset_val" type="radio" id="pppoe_weekly" value="weekly" <?php if ($pconfig['pppoe_weekly']) echo "checked=\"checked\""; ?> />
2828 136c598d Carlos Eduardo Ramos
														<?=gettext("reset at each week ('0 0 * * 0')"); ?>
2829 30ade846 gnhb
														<br />
2830 c0948c6c Renato Botelho
														<input name="pppoe_pr_preset_val" type="radio" id="pppoe_daily" value="daily" <?php if ($pconfig['pppoe_daily']) echo "checked=\"checked\""; ?> />
2831 136c598d Carlos Eduardo Ramos
														<?=gettext("reset at each day ('0 0 * * *')"); ?>
2832 30ade846 gnhb
														<br />
2833 c0948c6c Renato Botelho
														<input name="pppoe_pr_preset_val" type="radio" id="pppoe_hourly" value="hourly" <?php if ($pconfig['pppoe_hourly']) echo "checked=\"checked\""; ?> />
2834 136c598d Carlos Eduardo Ramos
														<?=gettext("reset at each hour ('0 * * * *')"); ?>
2835 30ade846 gnhb
														</p>
2836
													</td>
2837
												</tr>
2838
											</table>
2839
										</td>
2840
									</tr>
2841 c0948c6c Renato Botelho
2842 30ade846 gnhb
									<tr>
2843 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Advanced and MLPPP"); ?></td>
2844 30ade846 gnhb
										<?php if (isset($pconfig['pppid'])): ?>
2845 09637075 gnhb
											<td width="78%" class="vtable">
2846 c0948c6c Renato Botelho
											<a href="/interfaces_ppps_edit.php?id=<?=htmlspecialchars($pconfig['pppid']);?>" class="navlnk"><?=gettext("Click here"); ?> </a>
2847 933ea015 Carlos Eduardo Ramos
											<?=gettext("for additional PPPoE configuration options. Save first if you made changes."); ?>
2848 9978e156 gnhb
											</td>
2849 ee9933b6 Renato Botelho
										<?php else: ?>
2850 09637075 gnhb
											<td width="78%" class="vtable">
2851 136c598d Carlos Eduardo Ramos
											<a href="/interfaces_ppps_edit.php" class="navlnk"><?=gettext("Click here"); ?> </a>
2852 933ea015 Carlos Eduardo Ramos
											<?=gettext("for advanced PPPoE configuration options and MLPPP configuration."); ?>
2853 30ade846 gnhb
											</td>
2854 c0948c6c Renato Botelho
										<?php endif; ?>
2855 30ade846 gnhb
									</tr>
2856 a236affe N0YB
									<tr>
2857
										<td colspan="2" valign="top" height="16"></td>
2858
									</tr>
2859 30ade846 gnhb
								</table>
2860 87f0be87 Chris Buechler
							</td>
2861 667a3184 Scott Ullrich
						</tr>
2862 6e31ca39 N0YB
						<tr style="display:none;" id="pptp">
2863 30ade846 gnhb
							<td colspan="2" style="padding:0px;">
2864 168549b9 Colin Fleming
								<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="pptp">
2865 30ade846 gnhb
									<tr>
2866 e4d40f41 gnhb
										<td colspan="2" valign="top" class="listtopic"><?=gettext("PPTP/L2TP configuration"); ?></td>
2867 30ade846 gnhb
									</tr>
2868
									<tr>
2869 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Username"); ?></td>
2870 30ade846 gnhb
										<td width="78%" class="vtable">
2871 2cbe4b47 Colin Fleming
											<input name="pptp_username" type="text" class="formfld user" id="pptp_username" size="20" value="<?=htmlspecialchars($pconfig['pptp_username']);?>" />
2872 30ade846 gnhb
										</td>
2873
									</tr>
2874
									<tr>
2875 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Password"); ?></td>
2876 30ade846 gnhb
										<td width="78%" class="vtable">
2877 2cbe4b47 Colin Fleming
											<input name="pptp_password" type="password" class="formfld pwd" id="pptp_password" size="20" value="<?=htmlspecialchars($pconfig['pptp_password']);?>" />
2878 30ade846 gnhb
										</td>
2879
									</tr>
2880
									<tr>
2881 168549b9 Colin Fleming
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Local IP address"); ?></td>
2882 c0948c6c Renato Botelho
										<td width="78%" class="vtable">
2883 2cbe4b47 Colin Fleming
											<input name="pptp_local" type="text" class="formfld unknown" id="pptp_local" size="20"  value="<?=htmlspecialchars($pconfig['pptp_local'][0]);?>" />
2884 30ade846 gnhb
											/
2885
											<select name="pptp_subnet" class="formselect" id="pptp_subnet">
2886
												<?php for ($i = 31; $i > 0; $i--): ?>
2887 339d2743 Colin Fleming
													<option value="<?=$i;?>" <?php if ($i == $pconfig['pptp_subnet'][0]) echo "selected=\"selected\""; ?>>
2888 30ade846 gnhb
														<?=$i;?></option>
2889
												<?php endfor; ?>
2890
											</select>
2891
										</td>
2892
									</tr>
2893
									<tr>
2894 168549b9 Colin Fleming
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Remote IP address"); ?></td>
2895 30ade846 gnhb
										<td width="78%" class="vtable">
2896 2cbe4b47 Colin Fleming
											<input name="pptp_remote" type="text" class="formfld unknown" id="pptp_remote" size="20" value="<?=htmlspecialchars($pconfig['pptp_remote'][0]);?>" />
2897 30ade846 gnhb
										</td>
2898
									</tr>
2899
									<tr>
2900 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Dial on demand"); ?></td>
2901 30ade846 gnhb
										<td width="78%" class="vtable">
2902 339d2743 Colin Fleming
											<input name="pptp_dialondemand" type="checkbox" id="pptp_dialondemand" value="enable" <?php if ($pconfig['pptp_dialondemand']) echo "checked=\"checked\""; ?> />
2903 8cd558b6 ayvis
											<strong><?=gettext("Enable Dial-On-Demand mode"); ?></strong><br />
2904 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."); ?>
2905 30ade846 gnhb
										</td>
2906
									</tr>
2907
									<tr>
2908 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Idle timeout"); ?></td>
2909 30ade846 gnhb
										<td width="78%" class="vtable">
2910 8cd558b6 ayvis
											<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."); ?>
2911 30ade846 gnhb
										</td>
2912
									</tr>
2913 4a1ee8ac gnhb
									<tr>
2914 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Advanced"); ?></td>
2915 4a1ee8ac gnhb
										<?php if (isset($pconfig['pppid'])): ?>
2916
											<td width="78%" class="vtable">
2917 c0948c6c Renato Botelho
											<a href="/interfaces_ppps_edit.php?id=<?=htmlspecialchars($pconfig['pppid']);?>" class="navlnk"><?=gettext("Click here");?></a>
2918 933ea015 Carlos Eduardo Ramos
											<?=gettext("for additional PPTP and L2TP configuration options. Save first if you made changes.");?>
2919 4a1ee8ac gnhb
											</td>
2920 ee9933b6 Renato Botelho
										<?php else: ?>
2921 4a1ee8ac gnhb
											<td width="78%" class="vtable">
2922 4256d115 Renato Botelho
											<a href="/interfaces_ppps_edit.php" class="navlnk"><?=gettext("Click here");?></a>
2923
											<?=gettext("for advanced PPTP and L2TP configuration options");?>.
2924 4a1ee8ac gnhb
											</td>
2925 c0948c6c Renato Botelho
										<?php endif; ?>
2926 4a1ee8ac gnhb
									</tr>
2927 a236affe N0YB
									<tr>
2928
										<td colspan="2" valign="top" height="16"></td>
2929
									</tr>
2930 30ade846 gnhb
								</table>
2931
							</td>
2932
						</tr>
2933
						<?php
2934
							/* Wireless interface? */
2935
							if (isset($wancfg['wireless'])):
2936
						?>
2937 9978e156 gnhb
						<tr>
2938 136c598d Carlos Eduardo Ramos
							<td colspan="2" valign="top" class="listtopic"><?=gettext("Common wireless configuration - Settings apply to all wireless networks on"); ?> <?=$wlanbaseif;?>.</td>
2939 9978e156 gnhb
						</tr>
2940 f62c44d8 Erik Fonnesbeck
						<tr>
2941 4256d115 Renato Botelho
							<td valign="top" class="vncell"><?=gettext("Persist common settings");?></td>
2942 f62c44d8 Erik Fonnesbeck
							<td class="vtable">
2943 339d2743 Colin Fleming
								<input name="persistcommonwireless" type="checkbox" value="yes"  class="formfld" id="persistcommonwireless" <?php if ($pconfig['persistcommonwireless']) echo "checked=\"checked\"";?> />
2944 8cd558b6 ayvis
								<br /><?=gettext("Enabling this preserves the common wireless configuration through interface deletions and reassignments.");?>
2945 f62c44d8 Erik Fonnesbeck
							</td>
2946
						</tr>
2947 9978e156 gnhb
						<tr>
2948 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncellreq"><?=gettext("Standard"); ?></td>
2949 30ade846 gnhb
							<td class="vtable">
2950 3a13f094 gnhb
							<select name="standard" class="formselect" id="standard">
2951
								<?php
2952 6e31ca39 N0YB
								$rowIndex = 0;
2953 d325e908 Chris Buechler
								echo "<option ";
2954
								if ($pconfig['standard'] == "auto") {
2955
									echo "selected=\"selected\" ";
2956
								}
2957
								echo "value=\"auto\">auto</option>\n";
2958 3a13f094 gnhb
								foreach($wl_modes as $wl_standard => $wl_channels) {
2959 6e31ca39 N0YB
									$rowIndex++;
2960 3a13f094 gnhb
									echo "<option ";
2961 141d316c Chris Buechler
									if ($pconfig['standard'] == "$wl_standard") {
2962 339d2743 Colin Fleming
										echo "selected=\"selected\" ";
2963 141d316c Chris Buechler
									}
2964
									if ($pconfig['standard'] == "") {
2965
										if ($wl_standard == "11ng") {
2966
											echo "selected=\"selected\" ";
2967
										}
2968
									}
2969 3a13f094 gnhb
									echo "value=\"$wl_standard\">802.$wl_standard</option>\n";
2970
								}
2971 6e31ca39 N0YB
								if ($rowIndex == 0)
2972
									echo "<option></option>";
2973 3a13f094 gnhb
								?>
2974
							</select>
2975 30ade846 gnhb
							</td>
2976
						</tr>
2977
						<?php if (isset($wl_modes['11g'])): ?>
2978
						<tr>
2979 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncellreq">802.11g OFDM <?=gettext("Protection Mode"); ?></td>
2980 30ade846 gnhb
							<td class="vtable">
2981
								<select name="protmode" class="formselect" id="protmode">
2982 339d2743 Colin Fleming
									<option <?php if ($pconfig['protmode'] == 'off') echo "selected=\"selected\"";?> value="off"><?=gettext("Protection mode off"); ?></option>
2983
									<option <?php if ($pconfig['protmode'] == 'cts') echo "selected=\"selected\"";?> value="cts"><?=gettext("Protection mode CTS to self"); ?></option>
2984
									<option <?php if ($pconfig['protmode'] == 'rtscts') echo "selected=\"selected\"";?> value="rtscts"><?=gettext("Protection mode RTS and CTS"); ?></option>
2985 30ade846 gnhb
								</select>
2986 8cd558b6 ayvis
								<br />
2987 933ea015 Carlos Eduardo Ramos
								<?=gettext("For IEEE 802.11g, use the specified technique for protecting OFDM frames in a mixed 11b/11g network."); ?>
2988 8cd558b6 ayvis
								<br />
2989 30ade846 gnhb
							</td>
2990
						</tr>
2991
						<?php else: ?>
2992 2cbe4b47 Colin Fleming
						<input name="protmode" type="hidden" id="protmode" value="off" />
2993 30ade846 gnhb
						<?php endif; ?>
2994 f2f34088 Chris Buechler
						<?php /* txpower is disabled because of issues with it.
2995 30ade846 gnhb
						<tr>
2996 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncellreq"><?=gettext("Transmit power"); ?></td>
2997 30ade846 gnhb
							<td class="vtable">
2998
								<select name="txpower" class="formselect" id="txpower">
2999
									<?
3000
									for($x = 99; $x > 0; $x--) {
3001
										if($pconfig["txpower"] == $x)
3002 339d2743 Colin Fleming
											$SELECTED = " selected=\"selected\"";
3003 30ade846 gnhb
										else
3004
											$SELECTED = "";
3005
										echo "<option {$SELECTED}>{$x}</option>\n";
3006
									}
3007
									?>
3008 8cd558b6 ayvis
								</select><br />
3009 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."); ?>
3010 9978e156 gnhb
							</td>
3011 f2f34088 Chris Buechler
						</tr>*/
3012
						?>
3013 9978e156 gnhb
						<tr>
3014 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncellreq"><?=gettext("Channel"); ?></td>
3015 30ade846 gnhb
							<td class="vtable">
3016
								<select name="channel" class="formselect" id="channel">
3017 339d2743 Colin Fleming
									<option <?php if ($pconfig['channel'] == 0) echo "selected=\"selected\""; ?> value="0"><?=gettext("Auto"); ?></option>
3018 9978e156 gnhb
									<?php
3019 30ade846 gnhb
									foreach($wl_modes as $wl_standard => $wl_channels) {
3020
										if($wl_standard == "11g") { $wl_standard = "11b/g"; }
3021
										else if($wl_standard == "11ng") { $wl_standard = "11b/g/n"; }
3022
										else if($wl_standard == "11na") { $wl_standard = "11a/n"; }
3023
										foreach($wl_channels as $wl_channel) {
3024
											echo "<option ";
3025
											if ($pconfig['channel'] == "$wl_channel") {
3026 339d2743 Colin Fleming
												echo "selected=\"selected\" ";
3027 30ade846 gnhb
											}
3028
											echo "value=\"$wl_channel\">$wl_standard - $wl_channel";
3029
											if(isset($wl_chaninfo[$wl_channel]))
3030
												echo " ({$wl_chaninfo[$wl_channel][1]} @ {$wl_chaninfo[$wl_channel][2]} / {$wl_chaninfo[$wl_channel][3]})";
3031
											echo "</option>\n";
3032 d85ba87f gnhb
										}
3033 9978e156 gnhb
									}
3034
									?>
3035
								</select>
3036 8cd558b6 ayvis
								<br />
3037 136c598d Carlos Eduardo Ramos
								<?=gettext("Legend: wireless standards - channel # (frequency @ max TX power / TX power allowed in reg. domain)"); ?>
3038 8cd558b6 ayvis
								<br />
3039 933ea015 Carlos Eduardo Ramos
								<?=gettext("Note: Not all channels may be supported by your card.  Auto may override the wireless standard selected above."); ?>
3040 9978e156 gnhb
							</td>
3041
						</tr>
3042 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"])): ?>
3043
						<tr>
3044
							<td valign="top" class="vncell"><?=gettext("Antenna settings"); ?></td>
3045
							<td class="vtable">
3046 168549b9 Colin Fleming
								<table border="0" cellpadding="0" cellspacing="0" summary="antenna settings">
3047 537bf7b3 Erik Fonnesbeck
									<tr>
3048
										<?php if (isset($wl_sysctl["{$wl_sysctl_prefix}.diversity"])): ?>
3049
										<td>
3050 8cd558b6 ayvis
											<?=gettext("Diversity"); ?><br />
3051 537bf7b3 Erik Fonnesbeck
											<select name="diversity" class="formselect" id="diversity">
3052 339d2743 Colin Fleming
												<option <?php if (!isset($pconfig['diversity'])) echo "selected=\"selected\""; ?> value=""><?=gettext("Default"); ?></option>
3053
												<option <?php if ($pconfig['diversity'] === '0') echo "selected=\"selected\""; ?> value="0"><?=gettext("Off"); ?></option>
3054
												<option <?php if ($pconfig['diversity'] === '1') echo "selected=\"selected\""; ?> value="1"><?=gettext("On"); ?></option>
3055 537bf7b3 Erik Fonnesbeck
											</select>
3056
										</td>
3057 6e31ca39 N0YB
										<td>&nbsp;&nbsp;</td>
3058 537bf7b3 Erik Fonnesbeck
										<?php endif; ?>
3059
										<?php if (isset($wl_sysctl["{$wl_sysctl_prefix}.txantenna"])): ?>
3060
										<td>
3061 8cd558b6 ayvis
											<?=gettext("Transmit antenna"); ?><br />
3062 537bf7b3 Erik Fonnesbeck
											<select name="txantenna" class="formselect" id="txantenna">
3063 339d2743 Colin Fleming
												<option <?php if (!isset($pconfig['txantenna'])) echo "selected=\"selected\""; ?> value=""><?=gettext("Default"); ?></option>
3064
												<option <?php if ($pconfig['txantenna'] === '0') echo "selected=\"selected\""; ?> value="0"><?=gettext("Auto"); ?></option>
3065
												<option <?php if ($pconfig['txantenna'] === '1') echo "selected=\"selected\""; ?> value="1"><?=gettext("#1"); ?></option>
3066
												<option <?php if ($pconfig['txantenna'] === '2') echo "selected=\"selected\""; ?> value="2"><?=gettext("#2"); ?></option>
3067 537bf7b3 Erik Fonnesbeck
											</select>
3068
										</td>
3069 6e31ca39 N0YB
										<td>&nbsp;&nbsp;</td>
3070 537bf7b3 Erik Fonnesbeck
										<?php endif; ?>
3071
										<?php if (isset($wl_sysctl["{$wl_sysctl_prefix}.rxantenna"])): ?>
3072
										<td>
3073 8cd558b6 ayvis
											<?=gettext("Receive antenna"); ?><br />
3074 537bf7b3 Erik Fonnesbeck
											<select name="rxantenna" class="formselect" id="rxantenna">
3075 339d2743 Colin Fleming
												<option <?php if (!isset($pconfig['rxantenna'])) echo "selected=\"selected\""; ?> value=""><?=gettext("Default"); ?></option>
3076
												<option <?php if ($pconfig['rxantenna'] === '0') echo "selected=\"selected\""; ?> value="0"><?=gettext("Auto"); ?></option>
3077
												<option <?php if ($pconfig['rxantenna'] === '1') echo "selected=\"selected\""; ?> value="1"><?=gettext("#1"); ?></option>
3078
												<option <?php if ($pconfig['rxantenna'] === '2') echo "selected=\"selected\""; ?> value="2"><?=gettext("#2"); ?></option>
3079 537bf7b3 Erik Fonnesbeck
											</select>
3080
										</td>
3081
										<?php endif; ?>
3082
									</tr>
3083
								</table>
3084 8cd558b6 ayvis
								<br />
3085 537bf7b3 Erik Fonnesbeck
								<?=gettext("Note: The antenna numbers do not always match up with the labels on the card."); ?>
3086
							</td>
3087
						</tr>
3088
						<?php endif; ?>
3089 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"])): ?>
3090 9978e156 gnhb
						<tr>
3091 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Distance setting"); ?></td>
3092 30ade846 gnhb
							<td class="vtable">
3093 2cbe4b47 Colin Fleming
								<input name="distance" type="text" class="formfld unknown" id="distance" size="5" value="<?=htmlspecialchars($pconfig['distance']);?>" />
3094 8cd558b6 ayvis
								<br />
3095
								<?=gettext("Note: This field can be used to tune ACK/CTS timers to fit the distance between AP and Client"); ?><br />
3096 a819eab2 Chris Buechler
								<?=gettext("(measured in meters)"); ?>
3097 30ade846 gnhb
							</td>
3098 9978e156 gnhb
						</tr>
3099 6681fdd3 Erik Fonnesbeck
						<?php endif; ?>
3100 9978e156 gnhb
						<tr>
3101 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Regulatory settings"); ?></td>
3102 30ade846 gnhb
							<td class="vtable">
3103 8cd558b6 ayvis
								<?=gettext("Regulatory domain"); ?><br />
3104 30ade846 gnhb
								<select name="regdomain" class="formselect" id="regdomain">
3105 339d2743 Colin Fleming
									<option <?php if (empty($pconfig['regdomain'])) echo "selected=\"selected\""; ?> value=""><?=gettext("Default"); ?></option>
3106 30ade846 gnhb
									<?php
3107
									foreach($wl_regdomains as $wl_regdomain_key => $wl_regdomain) {
3108
										echo "<option ";
3109
										if ($pconfig['regdomain'] == $wl_regdomains_attr[$wl_regdomain_key]['ID']) {
3110 339d2743 Colin Fleming
											echo "selected=\"selected\" ";
3111 30ade846 gnhb
										}
3112
										echo "value=\"{$wl_regdomains_attr[$wl_regdomain_key]['ID']}\">{$wl_regdomain['name']}</option>\n";
3113
									}
3114
									?>
3115
								</select>
3116 8cd558b6 ayvis
								<br />
3117 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."); ?>
3118 8cd558b6 ayvis
								<br /><br />
3119
								<?=gettext("Country (listed with country code and regulatory domain)"); ?><br />
3120 30ade846 gnhb
								<select name="regcountry" class="formselect" id="regcountry">
3121 339d2743 Colin Fleming
									<option <?php if (empty($pconfig['regcountry'])) echo "selected=\"selected\""; ?> value=""><?=gettext("Default"); ?></option>
3122 30ade846 gnhb
									<?php
3123
									foreach($wl_countries as $wl_country_key => $wl_country) {
3124
										echo "<option ";
3125
										if ($pconfig['regcountry'] == $wl_countries_attr[$wl_country_key]['ID']) {
3126 339d2743 Colin Fleming
											echo "selected=\"selected\" ";
3127 30ade846 gnhb
										}
3128
										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";
3129
									}
3130
									?>
3131
								</select>
3132 8cd558b6 ayvis
								<br />
3133 136c598d Carlos Eduardo Ramos
								<?=gettext("Note: Any country setting other than \"Default\" will override the regulatory domain setting"); ?>.
3134 8cd558b6 ayvis
								<br /><br />
3135
								<?=gettext("Location"); ?><br />
3136 30ade846 gnhb
								<select name="reglocation" class="formselect" id="reglocation">
3137 339d2743 Colin Fleming
									<option <?php if (empty($pconfig['reglocation'])) echo "selected=\"selected\""; ?> value=""><?=gettext("Default"); ?></option>
3138
									<option <?php if ($pconfig['reglocation'] == 'indoor') echo "selected=\"selected\""; ?> value="indoor"><?=gettext("Indoor"); ?></option>
3139
									<option <?php if ($pconfig['reglocation'] == 'outdoor') echo "selected=\"selected\""; ?> value="outdoor"><?=gettext("Outdoor"); ?></option>
3140
									<option <?php if ($pconfig['reglocation'] == 'anywhere') echo "selected=\"selected\""; ?> value="anywhere"><?=gettext("Anywhere"); ?></option>
3141 30ade846 gnhb
								</select>
3142 8cd558b6 ayvis
								<br /><br />
3143 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."); ?>
3144 8cd558b6 ayvis
								<br />
3145 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."); ?>
3146 9978e156 gnhb
							</td>
3147
						</tr>
3148
						<tr>
3149 30ade846 gnhb
							<td colspan="2" valign="top" height="16"></td>
3150 c0948c6c Renato Botelho
						</tr>
3151 30ade846 gnhb
						<tr>
3152 4256d115 Renato Botelho
							<td colspan="2" valign="top" class="listtopic"><?=gettext("Network-specific wireless configuration");?></td>
3153 30ade846 gnhb
						</tr>
3154
						<tr>
3155 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncellreq"><?=gettext("Mode"); ?></td>
3156 30ade846 gnhb
							<td class="vtable">
3157
								<select name="mode" class="formselect" id="mode">
3158 339d2743 Colin Fleming
									<option <?php if ($pconfig['mode'] == 'bss') echo "selected=\"selected\"";?> value="bss"><?=gettext("Infrastructure (BSS)"); ?></option>
3159
									<option <?php if ($pconfig['mode'] == 'adhoc') echo "selected=\"selected\"";?> value="adhoc"><?=gettext("Ad-hoc (IBSS)"); ?></option>
3160
									<option <?php if ($pconfig['mode'] == 'hostap') echo "selected=\"selected\"";?> value="hostap"><?=gettext("Access Point"); ?></option>
3161 30ade846 gnhb
								</select>
3162 9978e156 gnhb
							</td>
3163
						</tr>
3164
						<tr>
3165 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncellreq"><?=gettext("SSID"); ?></td>
3166 30ade846 gnhb
							<td class="vtable">
3167 2cbe4b47 Colin Fleming
								<input name="ssid" type="text" class="formfld unknown" id="ssid" size="20" value="<?=htmlspecialchars($pconfig['ssid']); ?>" />
3168 8cd558b6 ayvis
								<br />
3169 cb3c3fe4 Namezero
								<?=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"); ?>
3170 9978e156 gnhb
							</td>
3171
						</tr>
3172 30ade846 gnhb
						<?php if (isset($wl_modes['11ng']) || isset($wl_modes['11na'])): ?>
3173 9978e156 gnhb
						<tr>
3174 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Minimum wireless standard"); ?></td>
3175 30ade846 gnhb
							<td class="vtable">
3176
								<select name="puremode" class="formselect" id="puremode">
3177 339d2743 Colin Fleming
									<option <?php if ($pconfig['puremode'] == 'any') echo "selected=\"selected\"";?> value="any"><?=gettext("Any"); ?></option>
3178 30ade846 gnhb
									<?php if (isset($wl_modes['11g'])): ?>
3179 339d2743 Colin Fleming
									<option <?php if ($pconfig['puremode'] == '11g') echo "selected=\"selected\"";?> value="11g"><?=gettext("802.11g"); ?></option>
3180 30ade846 gnhb
									<?php endif; ?>
3181 339d2743 Colin Fleming
									<option <?php if ($pconfig['puremode'] == '11n') echo "selected=\"selected\"";?> value="11n"><?=gettext("802.11n"); ?></option>
3182 30ade846 gnhb
								</select>
3183 8cd558b6 ayvis
								<br />
3184 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)."); ?>
3185 9978e156 gnhb
							</td>
3186
						</tr>
3187 30ade846 gnhb
						<?php elseif (isset($wl_modes['11g'])): ?>
3188 9978e156 gnhb
						<tr>
3189 933ea015 Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("802.11g only"); ?></td>
3190 30ade846 gnhb
							<td class="vtable">
3191 339d2743 Colin Fleming
								<input name="puremode" type="checkbox" value="11g"  class="formfld" id="puremode" <?php if ($pconfig['puremode'] == '11g') echo "checked=\"checked\"";?> />
3192 8cd558b6 ayvis
								<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)."); ?>
3193 9978e156 gnhb
							</td>
3194
						</tr>
3195 30ade846 gnhb
						<?php endif; ?>
3196 9978e156 gnhb
						<tr>
3197 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Allow intra-BSS communication"); ?></td>
3198 30ade846 gnhb
							<td class="vtable">
3199 339d2743 Colin Fleming
								<input name="apbridge_enable" type="checkbox" value="yes"  class="formfld" id="apbridge_enable" <?php if ($pconfig['apbridge_enable']) echo "checked=\"checked\"";?> />
3200 8cd558b6 ayvis
								<br />
3201 933ea015 Carlos Eduardo Ramos
								<?=gettext("When operating as an access point, enable this if you want to pass packets between wireless clients directly."); ?>
3202 8cd558b6 ayvis
								<br />
3203 933ea015 Carlos Eduardo Ramos
								<?=gettext("Disabling the internal bridging is useful when traffic is to be processed with packet filtering."); ?>
3204 30ade846 gnhb
							</td>
3205
						</tr>
3206
						<tr>
3207 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Enable WME"); ?></td>
3208 30ade846 gnhb
							<td class="vtable">
3209 339d2743 Colin Fleming
								<input name="wme_enable" type="checkbox" class="formfld" id="wme_enable" value="yes" <?php if ($pconfig['wme_enable']) echo "checked=\"checked\"";?> />
3210 8cd558b6 ayvis
								<br /><?=gettext("Setting this option will force the card to use WME (wireless QoS)."); ?>
3211 30ade846 gnhb
							</td>
3212
						</tr>
3213
						<tr>
3214 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Enable Hide SSID"); ?></td>
3215 30ade846 gnhb
							<td class="vtable">
3216 339d2743 Colin Fleming
								<input name="hidessid_enable" type="checkbox" class="formfld" id="hidessid_enable" value="yes" <?php if ($pconfig['hidessid_enable']) echo "checked=\"checked\"";?> />
3217 8cd558b6 ayvis
								<br />
3218 136c598d Carlos Eduardo Ramos
								<?=gettext("Setting this option will force the card to NOT broadcast its SSID"); ?>
3219 8cd558b6 ayvis
								<br />
3220 933ea015 Carlos Eduardo Ramos
								<?=gettext("(this might create problems for some clients)."); ?>
3221 30ade846 gnhb
							</td>
3222
						</tr>
3223
						<tr>
3224 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("WEP"); ?></td>
3225 c0948c6c Renato Botelho
							<td class="vtable">
3226 339d2743 Colin Fleming
								<input name="wep_enable" type="checkbox" id="wep_enable" value="yes" <?php if ($pconfig['wep_enable']) echo "checked=\"checked\""; ?> />
3227 136c598d Carlos Eduardo Ramos
								<strong><?=gettext("Enable WEP"); ?></strong>
3228 168549b9 Colin Fleming
								<table border="0" cellspacing="0" cellpadding="0" summary="wep">
3229 9978e156 gnhb
									<tr>
3230 30ade846 gnhb
										<td>&nbsp;</td>
3231
										<td>&nbsp;</td>
3232 136c598d Carlos Eduardo Ramos
										<td>&nbsp;<?=gettext("TX key"); ?>&nbsp;</td>
3233 30ade846 gnhb
									</tr>
3234
									<tr>
3235 933ea015 Carlos Eduardo Ramos
										<td><?=gettext("Key 1:"); ?>&nbsp;&nbsp;</td>
3236 30ade846 gnhb
										<td>
3237 2cbe4b47 Colin Fleming
											<input name="key1" type="text" class="formfld unknown" id="key1" size="30" value="<?=htmlspecialchars($pconfig['key1']);?>" />
3238 30ade846 gnhb
										</td>
3239
										<td align="center">
3240 6e31ca39 N0YB
											<input name="txkey" type="radio" value="1" <?php if ($pconfig['txkey'] == 1) echo "checked=\"checked\"";?> />
3241 30ade846 gnhb
										</td>
3242
									</tr>
3243
									<tr>
3244 933ea015 Carlos Eduardo Ramos
										<td><?=gettext("Key 2:"); ?>&nbsp;&nbsp;</td>
3245 30ade846 gnhb
										<td>
3246 2cbe4b47 Colin Fleming
											<input name="key2" type="text" class="formfld unknown" id="key2" size="30" value="<?=htmlspecialchars($pconfig['key2']);?>" />
3247 30ade846 gnhb
										</td>
3248
										<td align="center">
3249 339d2743 Colin Fleming
											<input name="txkey" type="radio" value="2" <?php if ($pconfig['txkey'] == 2) echo "checked=\"checked\"";?> />
3250 30ade846 gnhb
										</td>
3251
									</tr>
3252
									<tr>
3253 933ea015 Carlos Eduardo Ramos
										<td><?=gettext("Key 3:"); ?>&nbsp;&nbsp;</td>
3254 30ade846 gnhb
										<td>
3255 2cbe4b47 Colin Fleming
											<input name="key3" type="text" class="formfld unknown" id="key3" size="30" value="<?=htmlspecialchars($pconfig['key3']);?>" />
3256 30ade846 gnhb
										</td>
3257
										<td align="center">
3258 339d2743 Colin Fleming
											<input name="txkey" type="radio" value="3" <?php if ($pconfig['txkey'] == 3) echo "checked=\"checked\"";?> />
3259 30ade846 gnhb
										</td>
3260
									</tr>
3261
									<tr>
3262 933ea015 Carlos Eduardo Ramos
										<td><?=gettext("Key 4:"); ?>&nbsp;&nbsp;</td>
3263 30ade846 gnhb
										<td>
3264 2cbe4b47 Colin Fleming
											<input name="key4" type="text" class="formfld unknown" id="key4" size="30" value="<?=htmlspecialchars($pconfig['key4']);?>" />
3265 30ade846 gnhb
										</td>
3266
										<td align="center">
3267 339d2743 Colin Fleming
											<input name="txkey" type="radio" value="4" <?php if ($pconfig['txkey'] == 4) echo "checked=\"checked\"";?> />
3268 9978e156 gnhb
										</td>
3269
									</tr>
3270
								</table>
3271 8cd558b6 ayvis
								<br />
3272
								<?=gettext("40 (64) bit keys may be entered as 5 ASCII characters or 10 hex digits preceded by '0x'."); ?><br />
3273 933ea015 Carlos Eduardo Ramos
								<?=gettext("104 (128) bit keys may be entered as 13 ASCII characters or 26 hex digits preceded by '0x'."); ?>
3274 9978e156 gnhb
							</td>
3275
						</tr>
3276
						<tr>
3277 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("WPA"); ?></td>
3278 30ade846 gnhb
							<td class="vtable">
3279 339d2743 Colin Fleming
								<input name="wpa_enable" type="checkbox" class="formfld" id="wpa_enable" value="yes" <?php if ($pconfig['wpa_enable']) echo "checked=\"checked\""; ?> />
3280 136c598d Carlos Eduardo Ramos
								<strong><?=gettext("Enable WPA"); ?></strong>
3281 8cd558b6 ayvis
								<br /><br />
3282 168549b9 Colin Fleming
								<table border="0" cellspacing="0" cellpadding="0" summary="wpa">
3283 30ade846 gnhb
									<tr>
3284
										<td>&nbsp;</td>
3285 2a2b247b jim-p
										<td>&nbsp;<?=gettext("WPA Pre-Shared Key"); ?>&nbsp;</td>
3286 30ade846 gnhb
									</tr>
3287
									<tr>
3288 933ea015 Carlos Eduardo Ramos
										<td><?=gettext("PSK:"); ?>&nbsp;&nbsp;</td>
3289 30ade846 gnhb
										<td>
3290 2cbe4b47 Colin Fleming
											<input name="passphrase" type="text" class="formfld unknown" id="passphrase" size="66" value="<?=htmlspecialchars($pconfig['passphrase']);?>" />
3291 30ade846 gnhb
										</td>
3292
									</tr>
3293
								</table>
3294 310ea4e2 Chris Buechler
								<br /><?=gettext("WPA Passphrase must be between 8 and 63 characters long."); ?>
3295 30ade846 gnhb
							</td>
3296 9978e156 gnhb
						</tr>
3297
						<tr>
3298 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("WPA Mode"); ?></td>
3299 30ade846 gnhb
							<td class="vtable">
3300
								<select name="wpa_mode" class="formselect" id="wpa_mode">
3301 339d2743 Colin Fleming
									<option <?php if ($pconfig['wpa_mode'] == '1') echo "selected=\"selected\"";?> value="1"><?=gettext("WPA"); ?></option>
3302 d31517e5 Chris Buechler
									<option <?php if ($pconfig['wpa_mode'] == '2' || !isset($pconfig['wpa_mode'])) echo "selected=\"selected\"";?> value="2"><?=gettext("WPA2"); ?></option>
3303 339d2743 Colin Fleming
									<option <?php if ($pconfig['wpa_mode'] == '3') echo "selected=\"selected\"";?> value="3"><?=gettext("Both"); ?></option>
3304 30ade846 gnhb
								</select>
3305 9978e156 gnhb
							</td>
3306
						</tr>
3307
						<tr>
3308 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("WPA Key Management Mode"); ?></td>
3309 c0948c6c Renato Botelho
							<td class="vtable">
3310 30ade846 gnhb
								<select name="wpa_key_mgmt" class="formselect" id="wpa_key_mgmt">
3311 339d2743 Colin Fleming
									<option <?php if ($pconfig['wpa_key_mgmt'] == 'WPA-PSK') echo "selected=\"selected\"";?> value="WPA-PSK"><?=gettext("Pre-Shared Key"); ?></option>
3312
									<option <?php if ($pconfig['wpa_key_mgmt'] == 'WPA-EAP') echo "selected=\"selected\"";?> value="WPA-EAP"><?=gettext("Extensible Authentication Protocol"); ?></option>
3313
									<option <?php if ($pconfig['wpa_key_mgmt'] == 'WPA-PSK WPA-EAP') echo "selected=\"selected\"";?> value="WPA-PSK WPA-EAP"><?=gettext("Both"); ?></option>
3314 30ade846 gnhb
								</select>
3315 9978e156 gnhb
							</td>
3316
						</tr>
3317
						<tr>
3318 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Authentication"); ?></td>
3319 30ade846 gnhb
							<td class="vtable">
3320
								<select name="auth_algs" class="formselect" id="auth_algs">
3321 339d2743 Colin Fleming
									<option <?php if ($pconfig['auth_algs'] == '1') echo "selected=\"selected\"";?> value="1"><?=gettext("Open System Authentication"); ?></option>
3322
									<option <?php if ($pconfig['auth_algs'] == '2') echo "selected=\"selected\"";?> value="2"><?=gettext("Shared Key Authentication"); ?></option>
3323
									<option <?php if ($pconfig['auth_algs'] == '3') echo "selected=\"selected\"";?> value="3"><?=gettext("Both"); ?></option>
3324 9978e156 gnhb
								</select>
3325 8cd558b6 ayvis
								<br /><?=gettext("Note: Shared Key Authentication requires WEP."); ?><br />
3326 9978e156 gnhb
							</td>
3327
						</tr>
3328
						<tr>
3329 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("WPA Pairwise"); ?></td>
3330 30ade846 gnhb
							<td class="vtable">
3331
								<select name="wpa_pairwise" class="formselect" id="wpa_pairwise">
3332 339d2743 Colin Fleming
									<option <?php if ($pconfig['wpa_pairwise'] == 'CCMP TKIP') echo "selected=\"selected\"";?> value="CCMP TKIP"><?=gettext("Both"); ?></option>
3333 d31517e5 Chris Buechler
									<option <?php if ($pconfig['wpa_pairwise'] == 'CCMP' || !isset($pconfig['wpa_pairwise'])) echo "selected=\"selected\"";?> value="CCMP"><?=gettext("AES (recommended)"); ?></option>
3334 339d2743 Colin Fleming
									<option <?php if ($pconfig['wpa_pairwise'] == 'TKIP') echo "selected=\"selected\"";?> value="TKIP"><?=gettext("TKIP"); ?></option>
3335 30ade846 gnhb
								</select>
3336 9978e156 gnhb
							</td>
3337
						</tr>
3338
						<tr>
3339 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Key Rotation"); ?></td>
3340 30ade846 gnhb
							<td class="vtable">
3341 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";?>" />
3342 1188cdc8 Chris Buechler
								<br /><?=gettext("Allowed values are 1-9999. Must be longer than Master Key Regeneration time."); ?>
3343 9978e156 gnhb
							</td>
3344
						</tr>
3345
						<tr>
3346 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Master Key Regeneration"); ?></td>
3347 30ade846 gnhb
							<td class="vtable">
3348 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";?>" />
3349 1188cdc8 Chris Buechler
								<br /><?=gettext("Allowed values are 1-9999. Must be shorter than Key Rotation time."); ?>
3350 9978e156 gnhb
							</td>
3351
						</tr>
3352
						<tr>
3353 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Strict Key Regeneration"); ?></td>
3354 30ade846 gnhb
							<td class="vtable">
3355 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\""; ?> />
3356 8cd558b6 ayvis
								<br /><?=gettext("Setting this option will force the AP to rekey whenever a client disassociates."); ?>
3357 30ade846 gnhb
							</td>
3358 9978e156 gnhb
						</tr>
3359
						<tr>
3360 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Enable IEEE802.1X Authentication"); ?></td>
3361 30ade846 gnhb
							<td class="vtable">
3362 339d2743 Colin Fleming
								<input name="ieee8021x" type="checkbox" value="yes"  class="formfld" id="ieee8021x" <?php if ($pconfig['ieee8021x']) echo "checked=\"checked\"";?> />
3363 89e6f7af Chris Buechler
								<br /><?=gettext("Setting this option will enable 802.1X authentication."); ?>
3364 8cd558b6 ayvis
								<br /><span class="red"><strong><?=gettext("NOTE"); ?>:</strong></span> <?=gettext("this option requires checking the \"Enable WPA box\"."); ?>
3365 9978e156 gnhb
							</td>
3366
						</tr>
3367
						<tr>
3368 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("802.1X Authentication Server IP Address"); ?></td>
3369 30ade846 gnhb
							<td class="vtable">
3370 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']);?>" />
3371 8cd558b6 ayvis
								<br /><?=gettext("Enter the IP address of the 802.1X Authentication Server.  This is commonly a Radius server (FreeRadius, Internet Authentication Services, etc.)"); ?>
3372 9978e156 gnhb
							</td>
3373
						</tr>
3374
						<tr>
3375 933ea015 Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("802.1X Authentication Server Port"); ?></td>
3376 30ade846 gnhb
							<td class="vtable">
3377 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']);?>" />
3378 89e6f7af Chris Buechler
								<br /><?=gettext("Leave blank for the default port 1812."); ?>
3379 9978e156 gnhb
							</td>
3380
						</tr>
3381
						<tr>
3382 933ea015 Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("802.1X Authentication Server Shared Secret"); ?></td>
3383 30ade846 gnhb
							<td class="vtable">
3384 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']);?>" />
3385 8cd558b6 ayvis
								<br />
3386 9978e156 gnhb
							</td>
3387 30ade846 gnhb
						</tr>
3388 32764288 Namezero
						<tr>
3389
					<td valign="top" class="vncell"><?=gettext("Secondary 802.1X Authentication Server IP Address"); ?></td>
3390
							<td class="vtable">
3391 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']);?>" />
3392 8cd558b6 ayvis
								<br /><?=gettext("Enter the IP address of the 802.1X Authentication Server.  This is commonly a Radius server (FreeRadius, Internet Authentication Services, etc.)"); ?>
3393 32764288 Namezero
							</td>
3394
						</tr>
3395
						<tr>
3396
							<td valign="top" class="vncell"><?=gettext("Secondary 802.1X Authentication Server Port"); ?></td>
3397
							<td class="vtable">
3398 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']);?>" />
3399 89e6f7af Chris Buechler
								<br /><?=gettext("Leave blank for the default port 1812."); ?>
3400 32764288 Namezero
							</td>
3401
						</tr>
3402
						<tr>
3403
							<td valign="top" class="vncell"><?=gettext("Secondary 802.1X Authentication Server Shared Secret"); ?></td>
3404
							<td class="vtable">
3405 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']);?>" />
3406 8cd558b6 ayvis
								<br />
3407 32764288 Namezero
							</td>
3408
						</tr>
3409 c9e7d30d Scott Ullrich
						<tr>
3410
							<td valign="top" class="vncell">802.1X <?=gettext("Authentication Roaming Preauth"); ?></td>
3411
							<td class="vtable">
3412 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\""; ?> />
3413 8cd558b6 ayvis
								<br />
3414 c9e7d30d Scott Ullrich
							</td>
3415
						</tr>
3416 30ade846 gnhb
						<tr>
3417
							<td colspan="2" valign="top" height="16"></td>
3418
						</tr>
3419 a236affe N0YB
						<?php endif; ?>
3420 30ade846 gnhb
						<tr>
3421 136c598d Carlos Eduardo Ramos
							<td colspan="2" valign="top" class="listtopic"><?=gettext("Private networks"); ?></td>
3422 30ade846 gnhb
						</tr>
3423
						<tr>
3424
							<td valign="middle" class="vncell">&nbsp;</td>
3425
							<td class="vtable">
3426 c0948c6c Renato Botelho
								<a name="rfc1918"></a>
3427 339d2743 Colin Fleming
								<input name="blockpriv" type="checkbox" id="blockpriv" value="yes" <?php if ($pconfig['blockpriv']) echo "checked=\"checked\""; ?> />
3428 8cd558b6 ayvis
								<strong><?=gettext("Block private networks"); ?></strong><br />
3429 136c598d Carlos Eduardo Ramos
								<?=gettext("When set, this option blocks traffic from IP addresses that are reserved " .
3430
								"for private  networks as per RFC 1918 (10/8, 172.16/12, 192.168/16) as"); ?>
3431 933ea015 Carlos Eduardo Ramos
								<?=gettext("well as loopback addresses (127/8)."); ?>&nbsp;&nbsp; <?=gettext("You should generally " .
3432 136c598d Carlos Eduardo Ramos
								"leave this option turned on, unless your WAN network lies in such " .
3433 c0948c6c Renato Botelho
								"a private address space, too."); ?>
3434 9978e156 gnhb
							</td>
3435
						</tr>
3436
						<tr>
3437 30ade846 gnhb
							<td valign="middle" class="vncell">&nbsp;</td>
3438 c0948c6c Renato Botelho
							<td class="vtable">
3439 339d2743 Colin Fleming
								<input name="blockbogons" type="checkbox" id="blockbogons" value="yes" <?php if ($pconfig['blockbogons']) echo "checked=\"checked\""; ?> />
3440 8cd558b6 ayvis
								<strong><?=gettext("Block bogon networks"); ?></strong><br />
3441 136c598d Carlos Eduardo Ramos
								<?=gettext("When set, this option blocks traffic from IP addresses that are reserved " .
3442 933ea015 Carlos Eduardo Ramos
								"(but not RFC 1918) or not yet assigned by IANA."); ?>&nbsp;&nbsp;
3443 136c598d Carlos Eduardo Ramos
								<?=gettext("Bogons are prefixes that should never appear in the Internet routing table, " .
3444 933ea015 Carlos Eduardo Ramos
								"and obviously should not appear as the source address in any packets you receive."); ?>
3445 8cd558b6 ayvis
								<br /><br />
3446 6b4480dc bcyrill
								<?=gettext("Note: The update frequency can be changed under System->Advanced Firewall/NAT settings.")?>
3447 30ade846 gnhb
							</td>
3448 9978e156 gnhb
						</tr>
3449 1600b1af Scott Ullrich
					</table> <!-- End "allcfg" table -->
3450
					</div> <!-- End "allcfg" div -->
3451
3452 168549b9 Colin Fleming
					<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="buttons">
3453 9978e156 gnhb
						<tr>
3454 7b8db0c3 Erik Fonnesbeck
							<td width="22%" valign="top">
3455 30ade846 gnhb
								&nbsp;
3456
							</td>
3457 7b8db0c3 Erik Fonnesbeck
							<td width="78%">
3458 8cd558b6 ayvis
								<br />
3459 2cbe4b47 Colin Fleming
								<input id="save" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" />
3460 c4372d3c Renato Botelho
								<input id="cancel" type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" />
3461 e41ec584 Renato Botelho
								<input name="if" type="hidden" id="if" value="<?=htmlspecialchars($if);?>" />
3462 1d7e1d6c gnhb
								<?php if ($wancfg['if'] == $a_ppps[$pppid]['if']) : ?>
3463 2cbe4b47 Colin Fleming
								<input name="ppp_port" type="hidden" value="<?=htmlspecialchars($pconfig['port']);?>" />
3464 30ade846 gnhb
								<?php endif; ?>
3465 2cbe4b47 Colin Fleming
								<input name="ptpid" type="hidden" value="<?=htmlspecialchars($pconfig['ptpid']);?>" />
3466 9978e156 gnhb
							</td>
3467
						</tr>
3468 1600b1af Scott Ullrich
					</table>
3469 168549b9 Colin Fleming
					</div>
3470 9978e156 gnhb
				</td>
3471
			</tr>
3472
		</table>
3473
	</form>
3474 30ade846 gnhb
	<script type="text/javascript">
3475 32b91bcf Colin Fleming
	//<![CDATA[
3476 30ade846 gnhb
		var gatewayip;
3477
		var name;
3478 cfd40454 Seth Mos
		var gatewayipv6;
3479
		var namev6;
3480 30ade846 gnhb
		function show_add_gateway() {
3481
			document.getElementById("addgateway").style.display = '';
3482
			document.getElementById("addgwbox").style.display = 'none';
3483
			document.getElementById("gateway").style.display = 'none';
3484
			document.getElementById("save").style.display = 'none';
3485
			document.getElementById("cancel").style.display = 'none';
3486
			document.getElementById("gwsave").style.display = '';
3487
			document.getElementById("gwcancel").style.display = '';
3488 076b14b2 Vinicius Coque
			jQuery('#notebox').html("");
3489 30ade846 gnhb
		}
3490 cfd40454 Seth Mos
		function show_add_gateway_v6() {
3491
			document.getElementById("addgatewayv6").style.display = '';
3492
			document.getElementById("addgwboxv6").style.display = 'none';
3493
			document.getElementById("gatewayv6").style.display = 'none';
3494
			document.getElementById("save").style.display = 'none';
3495
			document.getElementById("cancel").style.display = 'none';
3496
			document.getElementById("gwsave").style.display = '';
3497
			document.getElementById("gwcancel").style.display = '';
3498 076b14b2 Vinicius Coque
			jQuery('#noteboxv6').html("");
3499 cfd40454 Seth Mos
		}
3500 30ade846 gnhb
		function hide_add_gateway() {
3501
			document.getElementById("addgateway").style.display = 'none';
3502 c0948c6c Renato Botelho
			document.getElementById("addgwbox").style.display = '';
3503 30ade846 gnhb
			document.getElementById("gateway").style.display = '';
3504
			document.getElementById("save").style.display = '';
3505
			document.getElementById("cancel").style.display = '';
3506
			document.getElementById("gwsave").style.display = '';
3507
			document.getElementById("gwcancel").style.display = '';
3508 56756d31 Renato Botelho
			jQuery('#status').html('');
3509 30ade846 gnhb
		}
3510 cfd40454 Seth Mos
		function hide_add_gateway_v6() {
3511
			document.getElementById("addgatewayv6").style.display = 'none';
3512
			document.getElementById("addgwboxv6").style.display = '';
3513
			document.getElementById("gatewayv6").style.display = '';
3514
			document.getElementById("save").style.display = '';
3515
			document.getElementById("cancel").style.display = '';
3516
			document.getElementById("gwsave").style.display = '';
3517
			document.getElementById("gwcancel").style.display = '';
3518 56756d31 Renato Botelho
			jQuery('#statusv6').html('');
3519 cfd40454 Seth Mos
		}
3520 30ade846 gnhb
		function hide_add_gatewaysave() {
3521
			document.getElementById("addgateway").style.display = 'none';
3522 7bc1b968 Renato Botelho
			jQuery('#status').html('<img src="/themes/<?=$g['theme'];?>/images/misc/loader.gif" alt="loader" /> One moment please...');
3523 076b14b2 Vinicius Coque
			var iface = jQuery('#if').val();
3524
			name = jQuery('#name').val();
3525
			var descr = jQuery('#gatewaydescr').val();
3526
			gatewayip = jQuery('#gatewayip').val();
3527 32764288 Namezero
3528 93ee6032 Renato Botelho
			var defaultgw = '';
3529
			if (jQuery('#defaultgw').is(':checked'))
3530
				defaultgw = '&defaultgw=on';
3531 30ade846 gnhb
			var url = "system_gateways_edit.php";
3532 93ee6032 Renato Botelho
			var pars = 'isAjax=true&ipprotocol=inet' + defaultgw + '&interface=' + escape(iface) + '&name=' + escape(name) + '&descr=' + escape(descr) + '&gateway=' + escape(gatewayip);
3533 076b14b2 Vinicius Coque
			jQuery.ajax(
3534 30ade846 gnhb
				url,
3535
				{
3536 076b14b2 Vinicius Coque
					type: 'post',
3537
					data: pars,
3538
					error: report_failure,
3539 56756d31 Renato Botelho
					success: save_callback
3540 c0948c6c Renato Botelho
				});
3541 30ade846 gnhb
		}
3542 cfd40454 Seth Mos
		function hide_add_gatewaysave_v6() {
3543
			document.getElementById("addgatewayv6").style.display = 'none';
3544 7bc1b968 Renato Botelho
			jQuery('#statusv6').html('<img src="/themes/<?=$g['theme'];?>/images/misc/loader.gif" alt="loader" /> One moment please...');
3545 076b14b2 Vinicius Coque
			var iface = jQuery('#if').val();
3546
			name = jQuery('#namev6').val();
3547
			var descr = jQuery('#gatewaydescrv6').val();
3548
			gatewayip = jQuery('#gatewayipv6').val();
3549 93ee6032 Renato Botelho
			var defaultgw = '';
3550
			if (jQuery('#defaultgwv6').is(':checked'))
3551
				defaultgw = '&defaultgw=on';
3552 cfd40454 Seth Mos
			var url_v6 = "system_gateways_edit.php";
3553 93ee6032 Renato Botelho
			var pars_v6 = 'isAjax=true&ipprotocol=inet6' + defaultgw + '&interface=' + escape(iface) + '&name=' + escape(name) + '&descr=' + escape(descr) + '&gateway=' + escape(gatewayip);
3554 076b14b2 Vinicius Coque
			jQuery.ajax(
3555 cfd40454 Seth Mos
				url_v6,
3556
				{
3557 076b14b2 Vinicius Coque
					type: 'post',
3558
					data: pars_v6,
3559
					error: report_failure_v6,
3560 56756d31 Renato Botelho
					success: save_callback_v6
3561 cfd40454 Seth Mos
				});
3562
		}
3563 30ade846 gnhb
		function addOption(selectbox,text,value)
3564
		{
3565
			var optn = document.createElement("OPTION");
3566
			optn.text = text;
3567
			optn.value = value;
3568 076b14b2 Vinicius Coque
			selectbox.append(optn);
3569
			selectbox.prop('selectedIndex',selectbox.children().length-1);
3570 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>");
3571 c0948c6c Renato Botelho
		}
3572 cfd40454 Seth Mos
		function addOption_v6(selectbox,text,value)
3573
		{
3574
			var optn = document.createElement("OPTION");
3575
			optn.text = text;
3576
			optn.value = value;
3577 076b14b2 Vinicius Coque
			selectbox.append(optn);
3578
			selectbox.prop('selectedIndex',selectbox.children().length-1);
3579 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>");
3580 cfd40454 Seth Mos
		}
3581 a0edece9 Darren Embry
		function report_failure(request, textStatus, errorThrown) {
3582
			if (textStatus === "error" && request.getResponseHeader("Content-Type") === "text/plain") {
3583
				alert(request.responseText);
3584
			} else {
3585
				alert("Sorry, we could not create your IPv4 gateway at this time.");
3586
			}
3587 30ade846 gnhb
			hide_add_gateway();
3588
		}
3589 a0edece9 Darren Embry
		function report_failure_v6(request, textStatus, errorThrown) {
3590
			if (textStatus === "error" && request.getResponseHeader("Content-Type") === "text/plain") {
3591
				alert(request.responseText);
3592
			} else {
3593
				alert("Sorry, we could not create your IPv6 gateway at this time.");
3594
			}
3595 cfd40454 Seth Mos
			hide_add_gateway_v6();
3596
		}
3597 6e704f19 Renato Botelho
		function save_callback(response) {
3598 30ade846 gnhb
			if(response) {
3599
				document.getElementById("addgateway").style.display = 'none';
3600
				hide_add_gateway();
3601 cfd40454 Seth Mos
				var gwtext = escape(name) + " - " + gatewayip;
3602 076b14b2 Vinicius Coque
				addOption(jQuery('#gateway'), gwtext, name);
3603 30ade846 gnhb
				// Auto submit form?
3604
				//document.iform.submit();
3605 7bc1b968 Renato Botelho
				//jQuery('#status').html('<img src="/themes/<?=$g['theme'];?>/images/misc/loader.gif" alt="loader /">');
3606 30ade846 gnhb
			} else {
3607
				report_failure();
3608
			}
3609
		}
3610 6e2a15e6 Evgeny Yurchenko
		function show_advanced_media() {
3611
			document.getElementById("showadvmediabox").innerHTML='';
3612
			aodiv = document.getElementById('showmediaadv');
3613
			aodiv.style.display = "block";
3614
		}
3615 6e704f19 Renato Botelho
		function save_callback_v6(response_v6) {
3616 cfd40454 Seth Mos
			if(response_v6) {
3617
				document.getElementById("addgatewayv6").style.display = 'none';
3618
				hide_add_gateway_v6();
3619
				var gwtext_v6 = escape(name) + " - " + gatewayip;
3620 076b14b2 Vinicius Coque
				addOption_v6(jQuery('#gatewayv6'), gwtext_v6, name);
3621 cfd40454 Seth Mos
				// Auto submit form?
3622
				//document.iform.submit();
3623 7bc1b968 Renato Botelho
				//jQuery('#statusv6').html('<img src="/themes/<?=$g['theme'];?>/images/misc/loader.gif" alt="loader" />');
3624 cfd40454 Seth Mos
			} else {
3625
				report_failure_v6();
3626
			}
3627
		}
3628 30ade846 gnhb
		<?php
3629 8672329c Erik Fonnesbeck
		echo "show_allcfg(document.iform.enable);";
3630 30ade846 gnhb
		echo "updateType('{$pconfig['type']}');\n";
3631 e029943a Seth Mos
		echo "updateTypeSix('{$pconfig['type6']}');\n";
3632 6c05cfb0 gnhb
		?>
3633 32b91bcf Colin Fleming
	//]]>
3634 30ade846 gnhb
	</script>
3635
	<?php include("fend.inc"); ?>
3636
	</body>
3637 b09a92b7 Ermal Luçi
</html>