Project

General

Profile

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