Project

General

Profile

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