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