Project

General

Profile

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