Project

General

Profile

Download (97.2 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 dd18038e Ermal
	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 dd18038e Ermal
// Populate page descr if it does not exist.
89
if ($if == "wan" && !$wancfg['descr'])
90
	$wancfg['descr'] = "WAN";
91
else if ($if == "lan" && !$wancfg['descr'])
92
	$wancfg['descr'] = "LAN";
93
94 5b237745 Scott Ullrich
95 8256f324 gnhb
foreach ($a_ppps as $pppid => $ppp) {
96 1d7e1d6c gnhb
	if ($wancfg['if'] == $ppp['if'])
97 8256f324 gnhb
		break;
98 30ade846 gnhb
}
99
100 1d7e1d6c gnhb
if ($wancfg['if'] == $a_ppps[$pppid]['if']) {
101 30ade846 gnhb
	$pconfig['pppid'] = $pppid;
102 1d7e1d6c gnhb
	$pconfig['ptpid'] = $a_ppps[$pppid]['ptpid'];
103
	$pconfig['port'] = $a_ppps[$pppid]['ports'];
104 3a906378 gnhb
	if ($a_ppps[$pppid]['type'] == "ppp"){
105
		$pconfig['username'] = $a_ppps[$pppid]['username'];
106
		$pconfig['password'] = base64_decode($a_ppps[$pppid]['password']);
107 c0948c6c Renato Botelho
108 3a906378 gnhb
		$pconfig['phone'] = $a_ppps[$pppid]['phone'];
109
		$pconfig['apn'] = $a_ppps[$pppid]['apn'];
110
	}
111 c0948c6c Renato Botelho
112 d85ba87f gnhb
	if ($a_ppps[$pppid]['type'] == "pppoe"){
113
		$pconfig['pppoe_username'] = $a_ppps[$pppid]['username'];
114
		$pconfig['pppoe_password'] = base64_decode($a_ppps[$pppid]['password']);
115
		$pconfig['provider'] = $a_ppps[$pppid]['provider'];
116
		$pconfig['pppoe_dialondemand'] = isset($a_ppps[$pppid]['ondemand']);
117
		$pconfig['pppoe_idletimeout'] = $a_ppps[$pppid]['idletimeout'];
118 5b237745 Scott Ullrich
119 d85ba87f gnhb
		/* ================================================ */
120
		/* = force a connection reset at a specific time? = */
121
		/* ================================================ */
122 c0948c6c Renato Botelho
123 d85ba87f gnhb
		if (isset($a_ppps[$pppid]['pppoe-reset-type'])) {
124
			$pconfig['pppoe-reset-type'] = $a_ppps[$pppid]['pppoe-reset-type'];
125 1d7e1d6c gnhb
			$itemhash = getMPDCRONSettings($a_ppps[$pppid]['if']);
126 e40e6724 gnhb
			$cronitem = $itemhash['ITEM'];
127
			if (isset($cronitem)) {
128
				$resetTime = "{$cronitem['minute']} {$cronitem['hour']} {$cronitem['mday']} {$cronitem['month']} {$cronitem['wday']}";
129
			} else {
130
				$resetTime = NULL;
131
			}
132
			log_error("ResetTime:".$resetTime);
133 d85ba87f gnhb
			if ($a_ppps[$pppid]['pppoe-reset-type'] == "custom") {
134
				$resetTime_a = split(" ", $resetTime);
135
				$pconfig['pppoe_pr_custom'] = true;
136
				$pconfig['pppoe_resetminute'] = $resetTime_a[0];
137
				$pconfig['pppoe_resethour'] = $resetTime_a[1];
138
				/*  just initialize $pconfig['pppoe_resetdate'] if the
139
				 *  coresponding item contains appropriate numeric values.
140
				 */
141 c0948c6c Renato Botelho
				if ($resetTime_a[2] <> "*" && $resetTime_a[3] <> "*")
142 d85ba87f gnhb
					$pconfig['pppoe_resetdate'] = "{$resetTime_a[3]}/{$resetTime_a[2]}/" . date("Y");
143
			} 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 e4d40f41 gnhb
$pconfig['dhcp_plus'] = isset($wancfg['dhcp_plus']);
179 f1f60c92 Ermal Luçi
$pconfig['descr'] = remove_bad_chars($wancfg['descr']);
180 6a688547 Ermal
$pconfig['enable'] = isset($wancfg['enable']);
181 f1f60c92 Ermal Luçi
182 9ff9a1c7 Seth Mos
if (is_array($config['aliases']['alias'])) {
183
	foreach($config['aliases']['alias'] as $alias) {
184
		if($alias['name'] == $wancfg['descr']) {
185 ea6be4a7 Erik Fonnesbeck
			$input_errors[] = sprintf(gettext("Sorry, an alias with the name %s already exists."),$wancfg['descr']);
186 9ff9a1c7 Seth Mos
		}
187
	}
188
}
189
190
switch($wancfg['ipaddr']) {
191
	case "dhcp":
192
		$pconfig['type'] = "dhcp";
193
		break;
194
	case "carpdev-dhcp":
195
		$pconfig['type'] = "carpdev-dhcp";
196
		$pconfig['ipaddr'] = "";
197
		break;
198
	case "pppoe":
199
	case "pptp":
200 e4d40f41 gnhb
	case "l2tp":
201 611ae852 Ermal
	case "ppp":
202 d85ba87f gnhb
		$pconfig['type'] = $wancfg['ipaddr'];
203 611ae852 Ermal
		break;
204 9ff9a1c7 Seth Mos
	default:
205
		if(is_ipaddr($wancfg['ipaddr'])) {
206
			$pconfig['type'] = "static";
207
			$pconfig['ipaddr'] = $wancfg['ipaddr'];
208
			$pconfig['subnet'] = $wancfg['subnet'];
209
			$pconfig['gateway'] = $wancfg['gateway'];
210 dd18038e Ermal
		} else
211 9ff9a1c7 Seth Mos
			$pconfig['type'] = "none";
212
		break;
213
}
214 5b237745 Scott Ullrich
215
$pconfig['blockpriv'] = isset($wancfg['blockpriv']);
216 ff1955ee Bill Marquette
$pconfig['blockbogons'] = isset($wancfg['blockbogons']);
217 5b237745 Scott Ullrich
$pconfig['spoofmac'] = $wancfg['spoofmac'];
218
$pconfig['mtu'] = $wancfg['mtu'];
219 4cea5cf8 Ermal
$pconfig['mss'] = $wancfg['mss'];
220 5b237745 Scott Ullrich
221
/* Wireless interface? */
222 b7f01f59 Bill Marquette
if (isset($wancfg['wireless'])) {
223 ebf94efb Erik Fonnesbeck
	/* Sync first to be sure it displays the actual settings that will be used */
224
	interface_sync_wireless_clones($wancfg, false);
225 4634cb48 Ermal Luçi
	/* Get wireless modes */
226 10394059 Scott Ullrich
	$wlanif = get_real_interface($if);
227 3f23b74d Erik Fonnesbeck
	if (!does_interface_exist($wlanif))
228
		interface_wireless_clone($wlanif, $wancfg);
229 34808d4e Erik Fonnesbeck
	$wlanbaseif = interface_get_wireless_base($wancfg['if']);
230 6681fdd3 Erik Fonnesbeck
	preg_match("/^(.*?)([0-9]*)$/", $wlanbaseif, $wlanbaseif_split);
231 10394059 Scott Ullrich
	$wl_modes = get_wireless_modes($if);
232 f4094f0d Erik Fonnesbeck
	$wl_chaninfo = get_wireless_channel_info($if);
233 6681fdd3 Erik Fonnesbeck
	$wl_sysctl_prefix = 'dev.' . $wlanbaseif_split[1] . '.' . $wlanbaseif_split[2];
234 537bf7b3 Erik Fonnesbeck
	$wl_sysctl = get_sysctl(array("{$wl_sysctl_prefix}.diversity", "{$wl_sysctl_prefix}.txantenna", "{$wl_sysctl_prefix}.rxantenna",
235
	                              "{$wl_sysctl_prefix}.slottime", "{$wl_sysctl_prefix}.acktimeout", "{$wl_sysctl_prefix}.ctstimeout"));
236 071d63b9 Erik Fonnesbeck
	$wl_regdomain_xml_attr = array();
237
	$wl_regdomain_xml = parse_xml_regdomain($wl_regdomain_xml_attr);
238
	$wl_regdomains = &$wl_regdomain_xml['regulatory-domains']['rd'];
239
	$wl_regdomains_attr = &$wl_regdomain_xml_attr['regulatory-domains']['rd'];
240
	$wl_countries = &$wl_regdomain_xml['country-codes']['country'];
241
	$wl_countries_attr = &$wl_regdomain_xml_attr['country-codes']['country'];
242 f62c44d8 Erik Fonnesbeck
	$pconfig['persistcommonwireless'] = isset($config['wireless']['interfaces'][$wlanbaseif]);
243 4634cb48 Ermal Luçi
	$pconfig['standard'] = $wancfg['wireless']['standard'];
244
	$pconfig['mode'] = $wancfg['wireless']['mode'];
245
	$pconfig['protmode'] = $wancfg['wireless']['protmode'];
246 ff2f4e43 Ermal Luçi
	$pconfig['ssid'] = $wancfg['wireless']['ssid'];
247 4634cb48 Ermal Luçi
	$pconfig['channel'] = $wancfg['wireless']['channel'];
248
	$pconfig['txpower'] = $wancfg['wireless']['txpower'];
249 537bf7b3 Erik Fonnesbeck
	$pconfig['diversity'] = $wancfg['wireless']['diversity'];
250
	$pconfig['txantenna'] = $wancfg['wireless']['txantenna'];
251
	$pconfig['rxantenna'] = $wancfg['wireless']['rxantenna'];
252 4634cb48 Ermal Luçi
	$pconfig['distance'] = $wancfg['wireless']['distance'];
253 20f09b3b Erik Fonnesbeck
	$pconfig['regdomain'] = $wancfg['wireless']['regdomain'];
254
	$pconfig['regcountry'] = $wancfg['wireless']['regcountry'];
255
	$pconfig['reglocation'] = $wancfg['wireless']['reglocation'];
256 4634cb48 Ermal Luçi
	$pconfig['wme_enable'] = isset($wancfg['wireless']['wme']['enable']);
257 57bbd532 Erik Fonnesbeck
	if (isset($wancfg['wireless']['puren']['enable']))
258
		$pconfig['puremode'] = '11n';
259
	else if (isset($wancfg['wireless']['pureg']['enable']))
260
		$pconfig['puremode'] = '11g';
261
	else
262
		$pconfig['puremode'] = 'any';
263 4634cb48 Ermal Luçi
	$pconfig['apbridge_enable'] = isset($wancfg['wireless']['apbridge']['enable']);
264
	$pconfig['authmode'] = $wancfg['wireless']['authmode'];
265
	$pconfig['hidessid_enable'] = isset($wancfg['wireless']['hidessid']['enable']);
266 5949124c Scott Ullrich
	$pconfig['auth_server_addr'] = $wancfg['wireless']['auth_server_addr'];
267
	$pconfig['auth_server_port'] = $wancfg['wireless']['auth_server_port'];
268
	$pconfig['auth_server_shared_secret'] = $wancfg['wireless']['auth_server_shared_secret'];
269 4634cb48 Ermal Luçi
	if (is_array($wancfg['wireless']['wpa'])) {
270
		$pconfig['debug_mode'] = $wancfg['wireless']['wpa']['debug_mode'];
271
		$pconfig['macaddr_acl'] = $wancfg['wireless']['wpa']['macaddr_acl'];
272
		$pconfig['mac_acl_enable'] = isset($wancfg['wireless']['wpa']['mac_acl_enable']);
273
		$pconfig['auth_algs'] = $wancfg['wireless']['wpa']['auth_algs'];
274
		$pconfig['wpa_mode'] = $wancfg['wireless']['wpa']['wpa_mode'];
275
		$pconfig['wpa_key_mgmt'] = $wancfg['wireless']['wpa']['wpa_key_mgmt'];
276
		$pconfig['wpa_pairwise'] = $wancfg['wireless']['wpa']['wpa_pairwise'];
277
		$pconfig['wpa_group_rekey'] = $wancfg['wireless']['wpa']['wpa_group_rekey'];
278
		$pconfig['wpa_gmk_rekey'] = $wancfg['wireless']['wpa']['wpa_gmk_rekey'];
279
		$pconfig['wpa_strict_rekey'] = isset($wancfg['wireless']['wpa']['wpa_strict_rekey']);
280
		$pconfig['passphrase'] = $wancfg['wireless']['wpa']['passphrase'];
281 bfe1ef8c Ermal Luçi
		$pconfig['ieee8021x'] = isset($wancfg['wireless']['wpa']['ieee8021x']['enable']);
282 ea62cd32 Scott Ullrich
		$pconfig['rsn_preauth'] = isset($wancfg['wireless']['wpa']['rsn_preauth']);
283 4634cb48 Ermal Luçi
		$pconfig['ext_wpa_sw'] = $wancfg['wireless']['wpa']['ext_wpa_sw'];
284
		$pconfig['wpa_enable'] = isset($wancfg['wireless']['wpa']['enable']);
285
	}
286
	$pconfig['wep_enable'] = isset($wancfg['wireless']['wep']['enable']);
287
	$pconfig['mac_acl'] = $wancfg['wireless']['mac_acl'];
288 270c4607 Scott Ullrich
	if (is_array($wancfg['wireless']['wep']) && is_array($wancfg['wireless']['wep']['key'])) {
289 53c82ef9 Scott Ullrich
		$i = 1;
290
		foreach ($wancfg['wireless']['wep']['key'] as $wepkey) {
291
			$pconfig['key' . $i] = $wepkey['value'];
292
			if (isset($wepkey['txkey']))
293
				$pconfig['txkey'] = $i;
294
			$i++;
295
		}
296
		if (!isset($wepkey['txkey']))
297
			$pconfig['txkey'] = 1;
298 4634cb48 Ermal Luçi
	}
299 5b237745 Scott Ullrich
}
300
301 43e255d2 Ermal Luçi
if ($_POST['apply']) {
302 7994c3f8 Ermal Luçi
	unset($input_errors);
303 a368a026 Ermal Lu?i
	if (!is_subsystem_dirty('interfaces'))
304 136c598d Carlos Eduardo Ramos
		$intput_errors[] = gettext("You have already applied your settings!");
305 c0948c6c Renato Botelho
	else {
306 270c4607 Scott Ullrich
		unlink_if_exists("{$g['tmp_path']}/config.cache");
307 a368a026 Ermal Lu?i
		clear_subsystem_dirty('interfaces');
308 c0948c6c Renato Botelho
309 dd18038e Ermal
		if (file_exists("{$g['tmp_path']}/.interfaces.apply")) {
310
			$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.interfaces.apply"));
311
			foreach ($toapplylist as $ifapply) {
312
				if (isset($config['interfaces'][$ifapply]['enable']))
313
					interface_configure($ifapply, true);
314
				else
315
					interface_bring_down($ifapply);
316
			}
317
		}
318 c0948c6c Renato Botelho
		/* restart snmp so that it binds to correct address */
319
		services_snmpd_configure();
320 a5d6f60b Ermal Lu?i
321 270c4607 Scott Ullrich
		/* sync filter configuration */
322 61fc1160 Scott Ullrich
		setup_gateways_monitor();
323 a5d6f60b Ermal Lu?i
324 a368a026 Ermal Lu?i
		clear_subsystem_dirty('staticroutes');
325 c0948c6c Renato Botelho
326 b4d36392 Scott Ullrich
		filter_configure();
327 c0948c6c Renato Botelho
328 1ee5d4b3 sullrich
		enable_rrd_graphing();
329 7994c3f8 Ermal Luçi
	}
330 dd18038e Ermal
	@unlink("{$g['tmp_path']}/.interfaces.apply");
331 7994c3f8 Ermal Luçi
	header("Location: interfaces.php?if={$if}");
332
	exit;
333 dd18038e Ermal
} else if ($_POST && $_POST['enable'] != "yes") {
334 270c4607 Scott Ullrich
	unset($wancfg['enable']);
335 dd18038e Ermal
	if (isset($wancfg['wireless']))
336 8f0289e7 Erik Fonnesbeck
		interface_sync_wireless_clones($wancfg, false);
337 270c4607 Scott Ullrich
	write_config("Interface {$_POST['descr']}({$if}) is now disabled.");
338 a368a026 Ermal Lu?i
	mark_subsystem_dirty('interfaces');
339 dd18038e Ermal
	if (file_exists("{$g['tmp_path']}/.interfaces.apply"))
340
		$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.interfaces.apply"));
341
	else
342
		$toapplylist = array();
343
	$toapplylist[$if] = $if; 
344
	file_put_contents("{$g['tmp_path']}/.interfaces.apply", serialize($toapplylist));
345 270c4607 Scott Ullrich
	header("Location: interfaces.php?if={$if}");
346
	exit;
347 dd18038e Ermal
} else if ($_POST) {
348 270c4607 Scott Ullrich
349 53c82ef9 Scott Ullrich
	unset($input_errors);
350
	$pconfig = $_POST;
351
	conf_mount_rw();
352 fe24301f Ermal
353 53c82ef9 Scott Ullrich
	/* filter out spaces from descriptions  */
354
	$_POST['descr'] = remove_bad_chars($_POST['descr']);
355 fe24301f Ermal
356 b4d36392 Scott Ullrich
	/* okay first of all, cause we are just hiding the PPPoE HTML
357 53c82ef9 Scott Ullrich
	 * fields releated to PPPoE resets, we are going to unset $_POST
358
	 * vars, if the reset feature should not be used. Otherwise the
359
	 * data validation procedure below, may trigger a false error
360
	 * message.
361
	 */
362 e40e6724 gnhb
	if (empty($_POST['pppoe-reset-type'])) {
363 c0948c6c Renato Botelho
		unset($_POST['pppoe_pr_type']);
364 53c82ef9 Scott Ullrich
		unset($_POST['pppoe_resethour']);
365
		unset($_POST['pppoe_resetminute']);
366
		unset($_POST['pppoe_resetdate']);
367
		unset($_POST['pppoe_pr_preset_val']);
368
	}
369
	/* description unique? */
370 dd18038e Ermal
	foreach ($ifdescrs as $ifent => $ifdescr) {
371 79851fc8 Ermal
		if ($if != $ifent && $ifdescr == $_POST['descr']) {
372 136c598d Carlos Eduardo Ramos
			$input_errors[] = gettext("An interface with the specified description already exists.");
373 79851fc8 Ermal
			break;
374
		}
375 53c82ef9 Scott Ullrich
	}
376
	/* input validation */
377 f94cf5f8 Ermal Lu?i
	if (isset($config['dhcpd']) && isset($config['dhcpd'][$if]['enable']) && $_POST['type'] != "static")
378 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.");
379 0c9da721 Ermal Lu?i
380 ef130e9f Ermal
	switch(strtolower($_POST['type'])) {
381 9ff9a1c7 Seth Mos
		case "static":
382
			$reqdfields = explode(" ", "ipaddr subnet gateway");
383 8cc6876f groo
			$reqdfieldsn = array(gettext("IP address"),gettext("Subnet bit count"),gettext("Gateway"));
384 9ff9a1c7 Seth Mos
			do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
385 8fc0b2dc Ermal
			break;
386 88c00a65 Ermal
		case "none":
387 62a4abc9 Ermal
			if(is_array($config['virtualip']['vip'])) {
388
				foreach ($config['virtualip']['vip'] as $vip) {
389
					if ($vip['interface'] == $if)
390
						$input_errors[] = gettext("This interface is referenced by VIPs please delete those before setting the interface to 'none' configuration.");
391
				}
392
			}
393 88c00a65 Ermal
		case "dhcp":
394 9ff9a1c7 Seth Mos
			break;
395 513b762e gnhb
		case "ppp":
396
			$reqdfields = explode(" ", "port phone");
397 8cc6876f groo
			$reqdfieldsn = array(gettext("Modem Port"),gettext("Phone Number"));
398 513b762e gnhb
			do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
399
			break;
400 ef130e9f Ermal
		case "pppoe":
401 9ff9a1c7 Seth Mos
			if ($_POST['pppoe_dialondemand']) {
402
				$reqdfields = explode(" ", "pppoe_username pppoe_password pppoe_dialondemand pppoe_idletimeout");
403 8cc6876f groo
				$reqdfieldsn = array(gettext("PPPoE username"),gettext("PPPoE password"),gettext("Dial on demand"),gettext("Idle timeout value"));
404 9ff9a1c7 Seth Mos
			} else {
405
				$reqdfields = explode(" ", "pppoe_username pppoe_password");
406 8cc6876f groo
				$reqdfieldsn = array(gettext("PPPoE username"),gettext("PPPoE password"));
407 9ff9a1c7 Seth Mos
			}
408
			do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
409
			break;
410 ef130e9f Ermal
		case "pptp":
411 9ff9a1c7 Seth Mos
			if ($_POST['pptp_dialondemand']) {
412
				$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote pptp_dialondemand pptp_idletimeout");
413 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"));
414 9ff9a1c7 Seth Mos
			} else {
415
				$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote");
416 8cc6876f groo
				$reqdfieldsn = array(gettext("PPTP username"),gettext("PPTP password"),gettext("PPTP local IP address"),gettext("PPTP subnet"),gettext("PPTP remote IP address"));
417 9ff9a1c7 Seth Mos
			}
418
			do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
419
			break;
420 e4d40f41 gnhb
		case "l2tp":
421
			if ($_POST['pptp_dialondemand']) {
422
				$reqdfields = explode(" ", "pptp_username pptp_password pptp_remote pptp_dialondemand pptp_idletimeout");
423
				$reqdfieldsn = array(gettext("L2TP username"),gettext("L2TP password"),gettext("L2TP remote IP address"),gettext("Dial on demand"),gettext("Idle timeout value"));
424
			} else {
425
				$reqdfields = explode(" ", "pptp_username pptp_password pptp_remote");
426
				$reqdfieldsn = array(gettext("L2TP username"),gettext("L2TP password"),gettext("L2TP remote IP address"));
427
			}
428
			do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
429
			break;
430 53c82ef9 Scott Ullrich
	}
431 9ff9a1c7 Seth Mos
432 53c82ef9 Scott Ullrich
	/* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */
433
	$_POST['spoofmac'] = strtolower(str_replace("-", ":", $_POST['spoofmac']));
434 c0948c6c Renato Botelho
	if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr'])))
435 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("A valid IP address must be specified.");
436 c0948c6c Renato Botelho
	if (($_POST['subnet'] && !is_numeric($_POST['subnet'])))
437 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("A valid subnet bit count must be specified.");
438 c0948c6c Renato Botelho
	if (($_POST['alias-address'] && !is_ipaddr($_POST['alias-address'])))
439 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("A valid alias IP address must be specified.");
440 c0948c6c Renato Botelho
	if (($_POST['alias-subnet'] && !is_numeric($_POST['alias-subnet'])))
441 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("A valid alias subnet bit count must be specified.");
442 53c82ef9 Scott Ullrich
	if ($_POST['gateway'] != "none") {
443
		$match = false;
444 9ff9a1c7 Seth Mos
		foreach($a_gateways as $gateway) {
445
			if(in_array($_POST['gateway'], $gateway)) {
446 53c82ef9 Scott Ullrich
				$match = true;
447 9ff9a1c7 Seth Mos
			}
448
		}
449
		if(!$match) {
450 136c598d Carlos Eduardo Ramos
			$input_errors[] = gettext("A valid gateway must be specified.");
451 9ff9a1c7 Seth Mos
		}
452 53c82ef9 Scott Ullrich
	}
453 c0948c6c Renato Botelho
	if (($_POST['provider'] && !is_domain($_POST['provider'])))
454 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("The service name contains invalid characters.");
455 c0948c6c Renato Botelho
	if (($_POST['pppoe_idletimeout'] != "") && !is_numericint($_POST['pppoe_idletimeout']))
456 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("The idle timeout value must be an integer.");
457 c0948c6c Renato Botelho
	if ($_POST['pppoe_resethour'] <> "" && !is_numericint($_POST['pppoe_resethour']) &&
458
		$_POST['pppoe_resethour'] >= 0 && $_POST['pppoe_resethour'] <=23)
459 53c82ef9 Scott Ullrich
			$input_errors[] = gettext("A valid PPPoE reset hour must be specified (0-23).");
460 c0948c6c Renato Botelho
	if ($_POST['pppoe_resetminute'] <> "" && !is_numericint($_POST['pppoe_resetminute']) &&
461
		$_POST['pppoe_resetminute'] >= 0 && $_POST['pppoe_resetminute'] <=59)
462 53c82ef9 Scott Ullrich
			$input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59).");
463 c0948c6c Renato Botelho
	if ($_POST['pppoe_resetdate'] <> "" && !is_numeric(str_replace("/", "", $_POST['pppoe_resetdate'])))
464 53c82ef9 Scott Ullrich
		$input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy).");
465 c0948c6c Renato Botelho
	if (($_POST['pptp_local'] && !is_ipaddr($_POST['pptp_local'])))
466 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("A valid PPTP local IP address must be specified.");
467 c0948c6c Renato Botelho
	if (($_POST['pptp_subnet'] && !is_numeric($_POST['pptp_subnet'])))
468 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("A valid PPTP subnet bit count must be specified.");
469 e4d40f41 gnhb
	if (($_POST['pptp_remote'] && !is_ipaddr($_POST['pptp_remote']) && !is_hostname($_POST['gateway'][$iface])))
470 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("A valid PPTP remote IP address must be specified.");
471 c0948c6c Renato Botelho
	if (($_POST['pptp_idletimeout'] != "") && !is_numericint($_POST['pptp_idletimeout']))
472 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("The idle timeout value must be an integer.");
473 c0948c6c Renato Botelho
	if (($_POST['spoofmac'] && !is_macaddr($_POST['spoofmac'])))
474 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("A valid MAC address must be specified.");
475 c0948c6c Renato Botelho
	if ($_POST['mtu'] && ($_POST['mtu'] < 576))
476 136c598d Carlos Eduardo Ramos
		$input_errors[] = gettext("The MTU must be greater than 576 bytes.");
477 c0948c6c Renato Botelho
	if ($_POST['mss'] && ($_POST['mss'] < 576))
478 4cea5cf8 Ermal
		$input_errors[] = gettext("The MSS must be greater than 576 bytes.");
479 53c82ef9 Scott Ullrich
	/* Wireless interface? */
480
	if (isset($wancfg['wireless'])) {
481
		$reqdfields = explode(" ", "mode ssid");
482 8cc6876f groo
		$reqdfieldsn = array(gettext("Mode"),gettext("SSID"));
483 53c82ef9 Scott Ullrich
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
484 597330aa Erik Fonnesbeck
		check_wireless_mode();
485 53c82ef9 Scott Ullrich
		/* loop through keys and enforce size */
486
		for ($i = 1; $i <= 4; $i++) {
487
			if ($_POST['key' . $i]) {
488
				/* 64 bit */
489
				if (strlen($_POST['key' . $i]) == 5)
490
					continue;
491
				if (strlen($_POST['key' . $i]) == 10) {
492
					/* hex key */
493
					if (stristr($_POST['key' . $i], "0x") == false) {
494 4634cb48 Ermal Luçi
						$_POST['key' . $i] = "0x" . $_POST['key' . $i];
495
					}
496 53c82ef9 Scott Ullrich
					continue;
497
				}
498
				if (strlen($_POST['key' . $i]) == 12) {
499
					/* hex key */
500
					if(stristr($_POST['key' . $i], "0x") == false) {
501
					$_POST['key' . $i] = "0x" . $_POST['key' . $i];
502 4634cb48 Ermal Luçi
					}
503 53c82ef9 Scott Ullrich
					continue;
504
				}
505
				/* 128 bit */
506
				if (strlen($_POST['key' . $i]) == 13)
507
					continue;
508
				if (strlen($_POST['key' . $i]) == 26) {
509
					/* hex key */
510
					if (stristr($_POST['key' . $i], "0x") == false)
511
						$_POST['key' . $i] = "0x" . $_POST['key' . $i];
512
					continue;
513 4634cb48 Ermal Luçi
				}
514 53c82ef9 Scott Ullrich
				if(strlen($_POST['key' . $i]) == 28)
515
					continue;
516 136c598d Carlos Eduardo Ramos
				$input_errors[] =  gettext("Invalid WEP key size.   Sizes should be 40 (64) bit keys or 104 (128) bit.");
517 53c82ef9 Scott Ullrich
				break;
518 4634cb48 Ermal Luçi
			}
519 5b237745 Scott Ullrich
		}
520 08fae438 Ermal Lu?i
521
		if ($_POST['passphrase']) {
522
                	$passlen = strlen($_POST['passphrase']);
523
                	if ($passlen < 8 || $passlen > 64)
524 136c598d Carlos Eduardo Ramos
                        	$input_errors[] = gettext("The length of the passphrase should be between 8 and 63 characters.");
525 08fae438 Ermal Lu?i
		}
526 53c82ef9 Scott Ullrich
	}
527
	if (!$input_errors) {
528 ef130e9f Ermal
		if ($wancfg['type'] != $_POST['type']) {
529
			if (in_array($wancfg['ipaddr'], array("ppp", "pppoe", "pptp", "l2tp"))) {
530
				$wancfg['if'] = $a_ppps[$pppid]['ports'];
531
				unset($a_ppps[$pppid]);
532 1f676b67 Ermal
			} else if ($wancfg['type'] == "dhcp") {
533
				$pid = find_dhclient_process($realif);
534
				if($pid)
535
					posix_kill($pid, SIGTERM);
536 ef130e9f Ermal
			}
537 1f676b67 Ermal
				
538 ef130e9f Ermal
		}
539 d85ba87f gnhb
		$ppp = array();
540 da75413d Ermal
		if ($wancfg['ipaddr'] != "ppp")
541
			unset($wancfg['ipaddr']);
542 53c82ef9 Scott Ullrich
		unset($wancfg['subnet']);
543
		unset($wancfg['gateway']);
544
		unset($wancfg['dhcphostname']);
545
		unset($wancfg['pppoe_username']);
546
		unset($wancfg['pppoe_password']);
547
		unset($wancfg['pptp_username']);
548
		unset($wancfg['pptp_password']);
549
		unset($wancfg['provider']);
550
		unset($wancfg['ondemand']);
551
		unset($wancfg['timeout']);
552 8b7ae9a3 jim-p
		if (isset($wancfg['pppoe']['pppoe-reset-type']))
553
			unset($wancfg['pppoe']['pppoe-reset-type']);
554 53c82ef9 Scott Ullrich
		unset($wancfg['local']);
555
		unset($wancfg['subnet']);
556
		unset($wancfg['remote']);
557 8256f324 gnhb
		unset($a_ppps[$pppid]['apn']);
558
		unset($a_ppps[$pppid]['phone']);
559
		unset($a_ppps[$pppid]['localip']);
560
		unset($a_ppps[$pppid]['subnet']);
561
		unset($a_ppps[$pppid]['gateway']);
562
		unset($a_ppps[$pppid]['pppoe-reset-type']);
563 1d7e1d6c gnhb
		unset($a_ppps[$pppid]['provider']);
564 c0948c6c Renato Botelho
565 53c82ef9 Scott Ullrich
		$wancfg['descr'] = remove_bad_chars($_POST['descr']);
566 6a688547 Ermal
		$wancfg['enable'] =  $_POST['enable']  == "yes" ? true : false;
567 9ff9a1c7 Seth Mos
568
		/* for dynamic interfaces we tack a gateway item onto the array to prevent system
569
		 * log messages from appearing. They can also manually add these items */
570
		/* 1st added gateway gets a default bit */
571 2f678757 Ermal
		if(!empty($a_gateways)) {
572
			$gateway_item = array();
573 9ff9a1c7 Seth Mos
			/* check for duplicates */
574
			$skip = false;
575
			foreach($a_gateways as $item) {
576
				if(($item['interface'] == "$if") && ($item['gateway'] == "dynamic")) {
577
					$skip = true;
578
				}
579
			}
580
			if($skip == false) {
581 136c598d Carlos Eduardo Ramos
				$gateway_item['gateway'] = gettext("dynamic");
582
				$gateway_item['descr'] = gettext("Interface") . $if . gettext("dynamic gateway");
583 9ff9a1c7 Seth Mos
				$gateway_item['name'] = "GW_" . strtoupper($if);
584
				$gateway_item['interface'] = "{$if}";
585
			} else {
586
				unset($gateway_item);
587
			}
588
		}
589 c0948c6c Renato Botelho
590 9ff9a1c7 Seth Mos
		switch($_POST['type']) {
591
			case "static":
592
				$wancfg['ipaddr'] = $_POST['ipaddr'];
593
				$wancfg['subnet'] = $_POST['subnet'];
594
				if ($_POST['gateway'] != "none") {
595
					$wancfg['gateway'] = $_POST['gateway'];
596
				}
597
				break;
598
			case "dhcp":
599
				$wancfg['ipaddr'] = "dhcp";
600
				$wancfg['dhcphostname'] = $_POST['dhcphostname'];
601
				$wancfg['alias-address'] = $_POST['alias-address'];
602
				$wancfg['alias-subnet'] = $_POST['alias-subnet'];
603 e4d40f41 gnhb
				$wancfg['dhcp_plus'] = $_POST['dhcp_plus'] == "yes" ? true : false;
604 9ff9a1c7 Seth Mos
				if($gateway_item) {
605
					$a_gateways[] = $gateway_item;
606
				}
607
				break;
608
			case "carpdev-dhcp":
609
				$wancfg['ipaddr'] = "carpdev-dhcp";
610
				$wancfg['dhcphostname'] = $_POST['dhcphostname'];
611
				$wancfg['alias-address'] = $_POST['alias-address'];
612
				$wancfg['alias-subnet'] = $_POST['alias-subnet'];
613
				if($gateway_item) {
614
					$a_gateways[] = $gateway_item;
615
				}
616
				break;
617 3a906378 gnhb
			case "ppp":
618
				$a_ppps[$pppid]['ptpid'] = $_POST['ptpid'];
619
				$a_ppps[$pppid]['type'] = $_POST['type'];
620 1d7e1d6c gnhb
				$a_ppps[$pppid]['if'] = $_POST['type'].$_POST['ptpid'];
621 3a906378 gnhb
				$a_ppps[$pppid]['ports'] = $_POST['port'];
622
				$a_ppps[$pppid]['username'] = $_POST['username'];
623
				$a_ppps[$pppid]['password'] = base64_encode($_POST['password']);
624 8256f324 gnhb
				$a_ppps[$pppid]['phone'] = $_POST['phone'];
625 3a906378 gnhb
				$a_ppps[$pppid]['apn'] = $_POST['apn'];
626 1d7e1d6c gnhb
				$wancfg['if'] = $_POST['type'] . $_POST['ptpid'];
627 8256f324 gnhb
				$wancfg['ipaddr'] = $_POST['type'];
628
				unset($a_ppps[$pppid]['ondemand']);
629
				unset($a_ppps[$pppid]['idletimeout']);
630 3a906378 gnhb
				break;
631
632 9ff9a1c7 Seth Mos
			case "pppoe":
633 6c05cfb0 gnhb
				$a_ppps[$pppid]['ptpid'] = $_POST['ptpid'];
634
				$a_ppps[$pppid]['type'] = $_POST['type'];
635 1d7e1d6c gnhb
				$a_ppps[$pppid]['if'] = $_POST['type'].$_POST['ptpid'];
636 d85ba87f gnhb
				if (isset($_POST['ppp_port']))
637 6c05cfb0 gnhb
					$a_ppps[$pppid]['ports'] = $_POST['ppp_port'];
638 d85ba87f gnhb
				else
639 6c05cfb0 gnhb
					$a_ppps[$pppid]['ports'] = $wancfg['if'];
640
				$a_ppps[$pppid]['username'] = $_POST['pppoe_username'];
641
				$a_ppps[$pppid]['password'] = base64_encode($_POST['pppoe_password']);
642 d85ba87f gnhb
				if (!empty($_POST['provider']))
643 6c05cfb0 gnhb
					$a_ppps[$pppid]['provider'] = $_POST['provider'];
644 d85ba87f gnhb
				else
645 6c05cfb0 gnhb
					unset($a_ppps[$pppid]['provider']);
646
				$a_ppps[$pppid]['ondemand'] = $_POST['pppoe_dialondemand'] ? true : false;
647 d85ba87f gnhb
				if (!empty($_POST['idletimeout']))
648 6c05cfb0 gnhb
					$a_ppps[$pppid]['idletimeout'] = $_POST['pppoe_idletimeout'];
649 d85ba87f gnhb
				else
650 6c05cfb0 gnhb
					unset($a_ppps[$pppid]['idletimeout']);
651 d85ba87f gnhb
652
				if (!empty($_POST['pppoe-reset-type']))
653 6c05cfb0 gnhb
					$a_ppps[$pppid]['pppoe-reset-type'] = $_POST['pppoe-reset-type'];
654 d85ba87f gnhb
				else
655 6c05cfb0 gnhb
					unset($a_ppps[$pppid]['pppoe-reset-type']);
656 1d7e1d6c gnhb
				$wancfg['if'] = $_POST['type'].$_POST['ptpid'];
657 d85ba87f gnhb
				$wancfg['ipaddr'] = $_POST['type'];
658 9ff9a1c7 Seth Mos
				if($gateway_item) {
659
					$a_gateways[] = $gateway_item;
660
				}
661 c0948c6c Renato Botelho
662 9ff9a1c7 Seth Mos
				break;
663
			case "pptp":
664 e4d40f41 gnhb
			case "l2tp":
665 6c05cfb0 gnhb
				$a_ppps[$pppid]['ptpid'] = $_POST['ptpid'];
666
				$a_ppps[$pppid]['type'] = $_POST['type'];
667 1d7e1d6c gnhb
				$a_ppps[$pppid]['if'] = $_POST['type'].$_POST['ptpid'];
668 d85ba87f gnhb
				if (isset($_POST['ppp_port']))
669 6c05cfb0 gnhb
					$a_ppps[$pppid]['ports'] = $_POST['ppp_port'];
670 d85ba87f gnhb
				else
671 6c05cfb0 gnhb
					$a_ppps[$pppid]['ports'] = $wancfg['if'];
672
				$a_ppps[$pppid]['username'] = $_POST['pptp_username'];
673
				$a_ppps[$pppid]['password'] = base64_encode($_POST['pptp_password']);
674 ced4df74 gnhb
				$a_ppps[$pppid]['localip'] = $_POST['pptp_local'];
675 6c05cfb0 gnhb
				$a_ppps[$pppid]['subnet'] = $_POST['pptp_subnet'];
676
				$a_ppps[$pppid]['gateway'] = $_POST['pptp_remote'];
677
				$a_ppps[$pppid]['ondemand'] = $_POST['pptp_dialondemand'] ? true : false;
678 d85ba87f gnhb
				if (!empty($_POST['idletimeout']))
679 6c05cfb0 gnhb
					$a_ppps[$pppid]['idletimeout'] = $_POST['pptp_idletimeout'];
680 d85ba87f gnhb
				else
681 6c05cfb0 gnhb
					unset($a_ppps[$pppid]['idletimeout']);
682 1d7e1d6c gnhb
				$wancfg['if'] = $_POST['type'].$_POST['ptpid'];
683 d85ba87f gnhb
				$wancfg['ipaddr'] = $_POST['type'];
684 9ff9a1c7 Seth Mos
				if($gateway_item) {
685
					$a_gateways[] = $gateway_item;
686
				}
687
				break;
688 6c05cfb0 gnhb
			case "none":
689
				break;
690 4634cb48 Ermal Luçi
		}
691 1d7e1d6c gnhb
		handle_pppoe_reset($_POST);
692 c0948c6c Renato Botelho
693 9ff9a1c7 Seth Mos
		if($_POST['blockpriv'] == "yes") {
694 53c82ef9 Scott Ullrich
			$wancfg['blockpriv'] = true;
695 9ff9a1c7 Seth Mos
		} else {
696 53c82ef9 Scott Ullrich
			unset($wancfg['blockpriv']);
697 9ff9a1c7 Seth Mos
		}
698
		if($_POST['blockbogons'] == "yes") {
699 53c82ef9 Scott Ullrich
			$wancfg['blockbogons'] = true;
700 9ff9a1c7 Seth Mos
		} else {
701 53c82ef9 Scott Ullrich
			unset($wancfg['blockbogons']);
702 9ff9a1c7 Seth Mos
		}
703 53c82ef9 Scott Ullrich
		$wancfg['spoofmac'] = $_POST['spoofmac'];
704 9ff9a1c7 Seth Mos
		if (empty($_POST['mtu'])) {
705 d6a891da Ermal Lu?i
			unset($wancfg['mtu']);
706 9ff9a1c7 Seth Mos
		} else {
707 d6a891da Ermal Lu?i
			$wancfg['mtu'] = $_POST['mtu'];
708 9ff9a1c7 Seth Mos
		}
709 4cea5cf8 Ermal
		if (empty($_POST['mss'])) {
710
			unset($wancfg['mss']);
711
		} else {
712
			$wancfg['mss'] = $_POST['mss'];
713
		}
714 9ff9a1c7 Seth Mos
		if (isset($wancfg['wireless'])) {
715 25a6411a Scott Ullrich
			handle_wireless_post();
716 9ff9a1c7 Seth Mos
		}
717 c0948c6c Renato Botelho
718 dd18038e Ermal
		conf_mount_ro();
719 53c82ef9 Scott Ullrich
		write_config();
720 dd18038e Ermal
721
		if (file_exists("{$g['tmp_path']}/.interfaces.apply"))
722
			$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.interfaces.apply"));
723
		else
724
			$toapplylist = array();
725
		$toapplylist[$if] = $if; 
726
		file_put_contents("{$g['tmp_path']}/.interfaces.apply", serialize($toapplylist));
727
728 a368a026 Ermal Lu?i
		mark_subsystem_dirty('interfaces');
729 dd18038e Ermal
730 53c82ef9 Scott Ullrich
		/* regenerate cron settings/crontab file */
731
		configure_cron();
732 dd18038e Ermal
733 53c82ef9 Scott Ullrich
		header("Location: interfaces.php?if={$if}");
734
		exit;
735
	}
736 c0948c6c Renato Botelho
737
} // end if($_POST)
738 270c4607 Scott Ullrich
739 25a6411a Scott Ullrich
function handle_wireless_post() {
740 f62c44d8 Erik Fonnesbeck
	global $_POST, $config, $g, $wancfg, $if, $wl_countries_attr, $wlanbaseif;
741 270c4607 Scott Ullrich
	if (!is_array($wancfg['wireless']))
742
		$wancfg['wireless'] = array();
743
	$wancfg['wireless']['standard'] = $_POST['standard'];
744
	$wancfg['wireless']['mode'] = $_POST['mode'];
745
	$wancfg['wireless']['protmode'] = $_POST['protmode'];
746
	$wancfg['wireless']['ssid'] = $_POST['ssid'];
747
	$wancfg['wireless']['channel'] = $_POST['channel'];
748
	$wancfg['wireless']['authmode'] = $_POST['authmode'];
749
	$wancfg['wireless']['txpower'] = $_POST['txpower'];
750
	$wancfg['wireless']['distance'] = $_POST['distance'];
751 20f09b3b Erik Fonnesbeck
	$wancfg['wireless']['regdomain'] = $_POST['regdomain'];
752
	$wancfg['wireless']['regcountry'] = $_POST['regcountry'];
753
	$wancfg['wireless']['reglocation'] = $_POST['reglocation'];
754
	if (!empty($wancfg['wireless']['regdomain']) && !empty($wancfg['wireless']['regcountry'])) {
755 071d63b9 Erik Fonnesbeck
		foreach($wl_countries_attr as $wl_country) {
756
			if ($wancfg['wireless']['regcountry'] == $wl_country['ID']) {
757
				$wancfg['wireless']['regdomain'] = $wl_country['rd'][0]['REF'];
758 20f09b3b Erik Fonnesbeck
				break;
759
			}
760
		}
761
	}
762 270c4607 Scott Ullrich
	if (!is_array($wancfg['wireless']['wpa']))
763
		$wancfg['wireless']['wpa'] = array();
764
	$wancfg['wireless']['wpa']['macaddr_acl'] = $_POST['macaddr_acl'];
765
	$wancfg['wireless']['wpa']['auth_algs'] = $_POST['auth_algs'];
766
	$wancfg['wireless']['wpa']['wpa_mode'] = $_POST['wpa_mode'];
767
	$wancfg['wireless']['wpa']['wpa_key_mgmt'] = $_POST['wpa_key_mgmt'];
768
	$wancfg['wireless']['wpa']['wpa_pairwise'] = $_POST['wpa_pairwise'];
769
	$wancfg['wireless']['wpa']['wpa_group_rekey'] = $_POST['wpa_group_rekey'];
770
	$wancfg['wireless']['wpa']['wpa_gmk_rekey'] = $_POST['wpa_gmk_rekey'];
771
	$wancfg['wireless']['wpa']['passphrase'] = $_POST['passphrase'];
772
	$wancfg['wireless']['wpa']['ext_wpa_sw'] = $_POST['ext_wpa_sw'];
773 5949124c Scott Ullrich
	$wancfg['wireless']['auth_server_addr'] = $_POST['auth_server_addr'];
774
	$wancfg['wireless']['auth_server_port'] = $_POST['auth_server_port'];
775
	$wancfg['wireless']['auth_server_shared_secret'] = $_POST['auth_server_shared_secret'];
776 f62c44d8 Erik Fonnesbeck
	if ($_POST['persistcommonwireless'] == "yes") {
777
		if (!is_array($config['wireless']['interfaces'][$wlanbaseif]))
778
			$config['wireless']['interfaces'][$wlanbaseif] = array();
779
	} else if (isset($config['wireless']['interfaces'][$wlanbaseif]))
780
		unset($config['wireless']['interfaces'][$wlanbaseif]);
781 1930ccb6 Erik Fonnesbeck
	if (isset($_POST['diversity']) && is_numeric($_POST['diversity']))
782 537bf7b3 Erik Fonnesbeck
		$wancfg['wireless']['diversity'] = $_POST['diversity'];
783
	else if (isset($wancfg['wireless']['diversity']))
784
		unset($wancfg['wireless']['diversity']);
785 1930ccb6 Erik Fonnesbeck
	if (isset($_POST['txantenna']) && is_numeric($_POST['txantenna']))
786 537bf7b3 Erik Fonnesbeck
		$wancfg['wireless']['txantenna'] = $_POST['txantenna'];
787
	else if (isset($wancfg['wireless']['txantenna']))
788
		unset($wancfg['wireless']['txantenna']);
789 1930ccb6 Erik Fonnesbeck
	if (isset($_POST['rxantenna']) && is_numeric($_POST['rxantenna']))
790 537bf7b3 Erik Fonnesbeck
		$wancfg['wireless']['rxantenna'] = $_POST['rxantenna'];
791
	else if (isset($wancfg['wireless']['rxantenna']))
792
		unset($wancfg['wireless']['rxantenna']);
793 270c4607 Scott Ullrich
	if ($_POST['hidessid_enable'] == "yes")
794
		$wancfg['wireless']['hidessid']['enable'] = true;
795
	else if (isset($wancfg['wireless']['hidessid']['enable']))
796
		unset($wancfg['wireless']['hidessid']['enable']);
797
	if ($_POST['mac_acl_enable'] == "yes")
798
		$wancfg['wireless']['wpa']['mac_acl_enable'] = true;
799
	else if (isset($wancfg['wireless']['wpa']['mac_acl_enable']))
800
		unset($wancfg['wireless']['wpa']['mac_acl_enable']);
801 c9e7d30d Scott Ullrich
	if ($_POST['rsn_preauth'] == "yes")
802 ea62cd32 Scott Ullrich
		$wancfg['wireless']['wpa']['rsn_preauth'] = true;
803 c0948c6c Renato Botelho
	else
804 ea62cd32 Scott Ullrich
		unset($wancfg['wireless']['wpa']['rsn_preauth']);
805 270c4607 Scott Ullrich
	if ($_POST['ieee8021x'] == "yes")
806
		$wancfg['wireless']['wpa']['ieee8021x']['enable'] = true;
807
	else if (isset($wancfg['wireless']['wpa']['ieee8021x']['enable']))
808
		unset($wancfg['wireless']['wpa']['ieee8021x']['enable']);
809
	if ($_POST['wpa_strict_rekey'] == "yes")
810
		$wancfg['wireless']['wpa']['wpa_strict_rekey'] = true;
811
	else if (isset($wancfg['wireless']['wpa']['wpa_strict_rekey']))
812
		unset($wancfg['wireless']['wpa']['wpa_strict_rekey']);
813
	if ($_POST['debug_mode'] == "yes")
814
		$wancfg['wireless']['wpa']['debug_mode'] = true;
815
	else if (isset($wancfg['wireless']['wpa']['debug_mode']))
816
		sunset($wancfg['wireless']['wpa']['debug_mode']);
817
	if ($_POST['wpa_enable'] == "yes")
818
		$wancfg['wireless']['wpa']['enable'] = $_POST['wpa_enable'] = true;
819
	else if (isset($wancfg['wireless']['wpa']['enable']))
820
		unset($wancfg['wireless']['wpa']['enable']);
821
	if ($_POST['wep_enable'] == "yes") {
822
		if (!is_array($wancfg['wireless']['wep']))
823
			$wancfg['wireless']['wep'] = array();
824
		$wancfg['wireless']['wep']['enable'] = $_POST['wep_enable'] = true;
825
	} else if (isset($wancfg['wireless']['wep']))
826
		unset($wancfg['wireless']['wep']);
827
	if ($_POST['wme_enable'] == "yes") {
828
		if (!is_array($wancfg['wireless']['wme']))
829
			$wancfg['wireless']['wme'] = array();
830
		$wancfg['wireless']['wme']['enable'] = $_POST['wme_enable'] = true;
831
	} else if (isset($wancfg['wireless']['wme']['enable']))
832
		unset($wancfg['wireless']['wme']['enable']);
833 57bbd532 Erik Fonnesbeck
	if ($_POST['puremode'] == "11g") {
834 270c4607 Scott Ullrich
		if (!is_array($wancfg['wireless']['pureg']))
835
			$wancfg['wireless']['pureg'] = array();
836 57bbd532 Erik Fonnesbeck
		$wancfg['wireless']['pureg']['enable'] = true;
837
	} else if ($_POST['puremode'] == "11n") {
838 ed459692 Erik Fonnesbeck
		if (!is_array($wancfg['wireless']['puren']))
839
			$wancfg['wireless']['puren'] = array();
840 57bbd532 Erik Fonnesbeck
		$wancfg['wireless']['puren']['enable'] = true;
841
	} else {
842
		if (isset($wancfg['wireless']['pureg']))
843
			unset($wancfg['wireless']['pureg']);
844
		if (isset($wancfg['wireless']['puren']))
845
			unset($wancfg['wireless']['puren']);
846
	}
847 270c4607 Scott Ullrich
	if ($_POST['apbridge_enable'] == "yes") {
848
		if (!is_array($wancfg['wireless']['apbridge']))
849
			$wancfg['wireless']['apbridge'] = array();
850
		$wancfg['wireless']['apbridge']['enable'] = $_POST['apbridge_enable'] = true;
851
	} else if (isset($wancfg['wireless']['apbridge']['enable']))
852
		unset($wancfg['wireless']['apbridge']['enable']);
853 9be20928 Erik Fonnesbeck
	if ($_POST['standard'] == "11g Turbo" || $_POST['standard'] == "11a Turbo") {
854 270c4607 Scott Ullrich
		if (!is_array($wancfg['wireless']['turbo']))
855
			$wancfg['wireless']['turbo'] = array();
856
		$wancfg['wireless']['turbo']['enable'] = true;
857
	} else if (isset($wancfg['wireless']['turbo']['enable']))
858
		unset($wancfg['wireless']['turbo']['enable']);
859
	$wancfg['wireless']['wep']['key'] = array();
860
	for ($i = 1; $i <= 4; $i++) {
861
		if ($_POST['key' . $i]) {
862
			$newkey = array();
863
			$newkey['value'] = $_POST['key' . $i];
864
			if ($_POST['txkey'] == $i)
865
				$newkey['txkey'] = true;
866
			$wancfg['wireless']['wep']['key'][] = $newkey;
867
		}
868 5b237745 Scott Ullrich
	}
869 8f0289e7 Erik Fonnesbeck
	interface_sync_wireless_clones($wancfg, true);
870 5b237745 Scott Ullrich
}
871 7f43ca88 Scott Ullrich
872 597330aa Erik Fonnesbeck
function check_wireless_mode() {
873 651fff4f Erik Fonnesbeck
	global $_POST, $config, $g, $wlan_modes, $wancfg, $if, $wlanif, $wlanbaseif, $old_wireless_mode, $input_errors;
874 597330aa Erik Fonnesbeck
875
	if ($wancfg['wireless']['mode'] == $_POST['mode'])
876
		return;
877
878
	if (does_interface_exist(interface_get_wireless_clone($wlanbaseif)))
879
		$clone_count = 1;
880
	else
881
		$clone_count = 0;
882
	if (is_array($config['wireless']['clone'])) {
883
		foreach ($config['wireless']['clone'] as $clone) {
884
			if ($clone['if'] == $wlanbaseif)
885
				$clone_count++;
886
		}
887
	}
888
	if ($clone_count > 1) {
889
		$old_wireless_mode = $wancfg['wireless']['mode'];
890
		$wancfg['wireless']['mode'] = $_POST['mode'];
891
		if (!interface_wireless_clone("{$wlanif}_", $wancfg)) {
892 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']]);
893 597330aa Erik Fonnesbeck
		} else {
894
			mwexec("/sbin/ifconfig {$wlanif}_ destroy");
895
		}
896
		$wancfg['wireless']['mode'] = $old_wireless_mode;
897
	}
898
}
899
900 a6d9251e Scott Ullrich
$pgtitle = array(gettext("Interfaces"), $pconfig['descr']);
901 af1e2031 jim-p
$statusurl = "status_interfaces.php";
902
903 58af5941 Scott Ullrich
$closehead = false;
904 7f43ca88 Scott Ullrich
include("head.inc");
905 e4d40f41 gnhb
$types = array("none" => gettext("None"), "static" => gettext("Static"), "dhcp" => gettext("DHCP"), "ppp" => gettext("PPP"), "pppoe" => gettext("PPPoE"), "pptp" => gettext("PPTP"), "l2tp" => gettext("L2TP") /* , "carpdev-dhcp" => "CarpDev"*/);
906 7f43ca88 Scott Ullrich
907 5b237745 Scott Ullrich
?>
908 7f43ca88 Scott Ullrich
909 8098302a Scott Ullrich
<script type="text/javascript" src="/javascript/numericupdown/js/numericupdown.js"></script>
910 58af5941 Scott Ullrich
<link href="/javascript/numericupdown/css/numericupdown.css" rel="stylesheet" type="text/css" />
911 8098302a Scott Ullrich
<script type="text/javascript" src="/javascript/datepicker/js/datepicker.js"></script>
912
<link href="/javascript/datepicker/css/datepicker.css" rel="stylesheet" type="text/css"/>
913 58af5941 Scott Ullrich
914
<script type="text/javascript">
915 9978e156 gnhb
	function updateType(t) {
916 886f1f69 Scott Ullrich
		switch(t) {
917 9978e156 gnhb
			case "none": {
918 6c05cfb0 gnhb
				$('static','dhcp','pppoe','pptp', 'ppp').invoke('hide');
919 9978e156 gnhb
				break;
920
			}
921
			case "static": {
922 6c05cfb0 gnhb
				$('none','dhcp','pppoe','pptp', 'ppp').invoke('hide');
923 9978e156 gnhb
				break;
924
			}
925
			case "dhcp": {
926 6c05cfb0 gnhb
				$('none','static','pppoe','pptp', 'ppp').invoke('hide');
927
				break;
928
			}
929
			case "ppp": {
930
				$('none','static','dhcp','pptp', 'pppoe').invoke('hide');
931 3a906378 gnhb
				country_list();
932 9978e156 gnhb
				break;
933
			}
934
			case "pppoe": {
935 6c05cfb0 gnhb
				$('none','static','dhcp','pptp', 'ppp').invoke('hide');
936 9978e156 gnhb
				break;
937
			}
938 e4d40f41 gnhb
			case "l2tp":
939 9978e156 gnhb
			case "pptp": {
940 6c05cfb0 gnhb
				$('none','static','dhcp','pppoe', 'ppp').invoke('hide');
941 e4d40f41 gnhb
				$('pptp').show();
942 9978e156 gnhb
				break;
943 09583657 Scott Ullrich
			}
944 886f1f69 Scott Ullrich
		}
945 e4d40f41 gnhb
		if (t != "l2tp" && t != "pptp")
946
			$(t).show();
947 09583657 Scott Ullrich
	}
948 15aea4cb Seth Mos
949 886f1f69 Scott Ullrich
	function show_allcfg(obj) {
950
		if (obj.checked)
951 df00291c Scott Ullrich
			$('allcfg').show();
952 886f1f69 Scott Ullrich
		else
953
			$('allcfg').hide();
954
	}
955 9978e156 gnhb
956 d85ba87f gnhb
	function show_reset_settings(reset_type) {
957 c0948c6c Renato Botelho
		if (reset_type == 'preset') {
958 d85ba87f gnhb
			Effect.Appear('pppoepresetwrap', { duration: 0.0 });
959 c0948c6c Renato Botelho
			Effect.Fade('pppoecustomwrap', { duration: 0.0 });
960
		}
961
		else if (reset_type == 'custom') {
962 d85ba87f gnhb
			Effect.Appear('pppoecustomwrap', { duration: 0.0 });
963
			Effect.Fade('pppoepresetwrap', { duration: 0.0 });
964
		} else {
965
			Effect.Fade('pppoecustomwrap', { duration: 0.0 });
966
			Effect.Fade('pppoepresetwrap', { duration: 0.0 });
967
		}
968
	}
969 886f1f69 Scott Ullrich
	function show_mon_config() {
970
		document.getElementById("showmonbox").innerHTML='';
971
		aodiv = document.getElementById('showmon');
972
		aodiv.style.display = "block";
973
	}
974 4634cb48 Ermal Luçi
975 886f1f69 Scott Ullrich
	function openwindow(url) {
976
		var oWin = window.open(url,"pfSensePop","width=620,height=400,top=150,left=150");
977 c0948c6c Renato Botelho
		if (oWin==null || typeof(oWin)=="undefined")
978 886f1f69 Scott Ullrich
			return false;
979 c0948c6c Renato Botelho
		else
980 886f1f69 Scott Ullrich
			return true;
981
	}
982 3a906378 gnhb
	function country_list() {
983
		$('country').childElements().each(function(node) { node.remove(); });
984
		$('provider').childElements().each(function(node) { node.remove(); });
985
		$('providerplan').childElements().each(function(node) { node.remove(); });
986
		new Ajax.Request("getserviceproviders.php",{
987
			onSuccess: function(response) {
988
				var responseTextArr = response.responseText.split("\n");
989
				responseTextArr.sort();
990
				responseTextArr.each( function(value) {
991
					var option = new Element('option');
992
					country = value.split(":");
993
					option.text = country[0];
994
					option.value = country[1];
995
					$('country').insert({ bottom : option });
996
				});
997
			}
998
		});
999
		$('trcountry').setStyle({display : "table-row"});
1000
	}
1001 c0948c6c Renato Botelho
1002 3a906378 gnhb
	function providers_list() {
1003
		$('provider').childElements().each(function(node) { node.remove(); });
1004
		$('providerplan').childElements().each(function(node) { node.remove(); });
1005
		new Ajax.Request("getserviceproviders.php",{
1006
			parameters: {country : $F('country')},
1007
			onSuccess: function(response) {
1008
				var responseTextArr = response.responseText.split("\n");
1009
				responseTextArr.sort();
1010
				responseTextArr.each( function(value) {
1011
					var option = new Element('option');
1012
					option.text = value;
1013
					option.value = value;
1014
					$('provider').insert({ bottom : option });
1015
				});
1016
			}
1017
		});
1018
		$('trprovider').setStyle({display : "table-row"});
1019
		$('trproviderplan').setStyle({display : "none"});
1020
	}
1021 c0948c6c Renato Botelho
1022 3a906378 gnhb
	function providerplan_list() {
1023
		$('providerplan').childElements().each(function(node) { node.remove(); });
1024
		$('providerplan').insert( new Element('option') );
1025
		new Ajax.Request("getserviceproviders.php",{
1026
			parameters: {country : $F('country'), provider : $F('provider')},
1027
			onSuccess: function(response) {
1028
				var responseTextArr = response.responseText.split("\n");
1029
				responseTextArr.sort();
1030
				responseTextArr.each( function(value) {
1031
					if(value != "") {
1032
						providerplan = value.split(":");
1033 c0948c6c Renato Botelho
1034 3a906378 gnhb
						var option = new Element('option');
1035
						option.text = providerplan[0] + " - " + providerplan[1];
1036
						option.value = providerplan[1];
1037
						$('providerplan').insert({ bottom : option });
1038
					}
1039
				});
1040
			}
1041
		});
1042
		$('trproviderplan').setStyle({display : "table-row"});
1043
	}
1044 c0948c6c Renato Botelho
1045 3a906378 gnhb
	function prefill_provider() {
1046
		new Ajax.Request("getserviceproviders.php",{
1047
			parameters: {country : $F('country'), provider : $F('provider'), plan : $F('providerplan')},
1048
			onSuccess: function(response) {
1049
				var xmldoc = response.responseXML;
1050
				var provider = xmldoc.getElementsByTagName('connection')[0];
1051
				$('username').setValue('');
1052
				$('password').setValue('');
1053
				if(provider.getElementsByTagName('apn')[0].firstChild.data == "CDMA") {
1054 f1ca6b86 Chris Buechler
					$('phone').setValue('#777');
1055 3a906378 gnhb
					$('apn').setValue('');
1056
				} else {
1057
					$('phone').setValue('*99#');
1058
					$('apn').setValue(provider.getElementsByTagName('apn')[0].firstChild.data);
1059
				}
1060
				$('username').setValue(provider.getElementsByTagName('username')[0].firstChild.data);
1061
				$('password').setValue(provider.getElementsByTagName('password')[0].firstChild.data);
1062
			}
1063
		});
1064
	}
1065
1066 5b237745 Scott Ullrich
</script>
1067 58af5941 Scott Ullrich
</head>
1068 886f1f69 Scott Ullrich
	<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
1069
	<?php include("fbegin.inc"); ?>
1070
	<form action="interfaces.php" method="post" name="iform" id="iform">
1071
		<?php if ($input_errors) print_input_errors($input_errors); ?>
1072 a368a026 Ermal Lu?i
		<?php if (is_subsystem_dirty('interfaces')): ?><p>
1073 ea6be4a7 Erik Fonnesbeck
		<?php print_info_box_np(sprintf(gettext("The %s configuration has been changed."),$wancfg['descr'])."<p>".gettext("You must apply the changes in order for them to take effect.")."<p>".gettext("Don't forget to adjust the DHCP Server range if needed after applying."));?><br />
1074 744ea190 Scott Ullrich
		<?php endif; ?>
1075
		<?php if ($savemsg) print_info_box($savemsg); ?>
1076 98f43e13 Scott Ullrich
		<table width="100%" border="0" cellpadding="6" cellspacing="0">
1077 09583657 Scott Ullrich
			<tr>
1078 30ade846 gnhb
				<td id="mainarea">
1079
					<div class="tabcont">
1080 09583657 Scott Ullrich
					<table width="100%" border="0" cellpadding="6" cellspacing="0">
1081
						<tr>
1082 136c598d Carlos Eduardo Ramos
							<td colspan="2" valign="top" class="listtopic"><?=gettext("General configuration"); ?></td>
1083 09583657 Scott Ullrich
						</tr>
1084
						<tr>
1085 136c598d Carlos Eduardo Ramos
							<td width="22%" valign="top" class="vncell"><?=gettext("Enable"); ?></td>
1086 30ade846 gnhb
							<td width="78%" class="vtable">
1087
								<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable'] == true) echo "checked"; ?> onClick="show_allcfg(this);">
1088 136c598d Carlos Eduardo Ramos
							<strong><?=gettext("Enable Interface"); ?></strong>
1089 09583657 Scott Ullrich
							</td>
1090
						</tr>
1091 30ade846 gnhb
					</table>
1092
					<div style="display:none;" name="allcfg" id="allcfg">
1093
					<table width="100%" border="0" cellpadding="6" cellspacing="0">
1094 09583657 Scott Ullrich
						<tr>
1095 136c598d Carlos Eduardo Ramos
							<td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
1096 09583657 Scott Ullrich
							<td width="78%" class="vtable">
1097 30ade846 gnhb
								<input name="descr" type="text" class="formfld unknown" id="descr" size="30" value="<?=htmlspecialchars($pconfig['descr']);?>">
1098 8cc6876f groo
								<br><span class="vexpl"><?= gettext("Enter a description (name) for the interface here."); ?></span>
1099 30ade846 gnhb
							</td>
1100
						</tr>
1101
						<tr>
1102 136c598d Carlos Eduardo Ramos
							<td valign="middle" class="vncell"><strong><?=gettext("Type"); ?></strong></td>
1103 c0948c6c Renato Botelho
							<td class="vtable">
1104 30ade846 gnhb
								<select name="type" onChange="updateType(this.value);" class="formselect" id="type">
1105 c0948c6c Renato Botelho
								<?php
1106
									foreach ($types as $key => $opt) {
1107 3a13f094 gnhb
										echo "<option onClick=\"updateType('{$key}');\"";
1108 c0948c6c Renato Botelho
										if ($key == $pconfig['type'])
1109 3a13f094 gnhb
											echo " selected";
1110
										echo " value=\"{$key}\" >" . htmlspecialchars($opt);
1111
										echo "</option>";
1112 c0948c6c Renato Botelho
									}
1113 30ade846 gnhb
								?>
1114 667a3184 Scott Ullrich
								</select>
1115 30ade846 gnhb
							</td>
1116
						</tr>
1117
						<tr>
1118 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("MAC address"); ?></td>
1119 30ade846 gnhb
							<td class="vtable">
1120
								<input name="spoofmac" type="text" class="formfld unknown" id="spoofmac" size="30" value="<?=htmlspecialchars($pconfig['spoofmac']);?>">
1121
								<?php
1122
									$ip = getenv('REMOTE_ADDR');
1123
									$mac = `/usr/sbin/arp -an | grep {$ip} | cut -d" " -f4`;
1124
									$mac = str_replace("\n","",$mac);
1125
									if($mac):
1126
								?>
1127 136c598d Carlos Eduardo Ramos
									<a OnClick="document.forms[0].spoofmac.value='<?=$mac?>';" href="#"><?=gettext("Insert my local MAC address"); ?></a>
1128 30ade846 gnhb
								<?php endif; ?>
1129
								<br>
1130 136c598d Carlos Eduardo Ramos
								<?=gettext("This field can be used to modify (\"spoof\") the MAC " .
1131
								"address of the WAN interface"); ?><br>
1132
								<?=gettext("(may be required with some cable connections)"); ?><br>
1133
								<?=gettext("Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx " .
1134
								"or leave blank"); ?>
1135 30ade846 gnhb
							</td>
1136
						</tr>
1137
						<tr>
1138 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("MTU"); ?></td>
1139 c0948c6c Renato Botelho
							<td class="vtable">
1140 30ade846 gnhb
								<input name="mtu" type="text" class="formfld unknown" id="mtu" size="8" value="<?=htmlspecialchars($pconfig['mtu']);?>">
1141
								<br>
1142 bd6f4dcc jim-p
								<?=gettext("If you leave this field blank, the adapter's default MTU will " .
1143
								"be used. This is typically 1500 bytes but can vary on some hardware."); ?>
1144 4cea5cf8 Ermal
							</td>
1145
						</tr>
1146
						<tr>
1147
							<td valign="top" class="vncell"><?=gettext("MSS"); ?></td>
1148 c0948c6c Renato Botelho
							<td class="vtable">
1149 4cea5cf8 Ermal
								<input name="mss" type="text" class="formfld unknown" id="mss" size="8" value="<?=htmlspecialchars($pconfig['mss']);?>">
1150
								<br>
1151 136c598d Carlos Eduardo Ramos
								<?=gettext("If you enter a value in this field, then MSS clamping for " .
1152 c0948c6c Renato Botelho
								"TCP connections to the value entered above minus 40 (TCP/IP " .
1153
								"header size) will be in effect."); ?>
1154 30ade846 gnhb
							</td>
1155
						</tr>
1156
						<tr>
1157
							<td colspan="2" valign="top" height="16"></td>
1158 c0948c6c Renato Botelho
						</tr>
1159 30ade846 gnhb
						<tr style="display:none;" name="none" id="none">
1160
						</tr>
1161
						<tr style="display:none;" name="static" id="static">
1162
							<td colspan="2" style="padding:0px;">
1163
								<table width="100%" border="0" cellpadding="6" cellspacing="0">
1164
									<tr>
1165 136c598d Carlos Eduardo Ramos
										<td colspan="2" valign="top" class="listtopic"><?=gettext("Static IP configuration"); ?></td>
1166 30ade846 gnhb
									</tr>
1167
									<tr>
1168 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncellreq"><?=gettext("IP address"); ?></td>
1169 c0948c6c Renato Botelho
										<td width="78%" class="vtable">
1170 30ade846 gnhb
											<input name="ipaddr" type="text" class="formfld unknown" id="ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>">
1171
											/
1172
											<select name="subnet" class="formselect" id="subnet">
1173
												<?php
1174
												for ($i = 32; $i > 0; $i--) {
1175
													if($i <> 31) {
1176
														echo "<option value=\"{$i}\" ";
1177
														if ($i == $pconfig['subnet']) echo "selected";
1178
														echo ">" . $i . "</option>";
1179
													}
1180
												}
1181
												?>
1182
											</select>
1183
										</td>
1184
									</tr>
1185
									<tr>
1186 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Gateway"); ?></td>
1187 30ade846 gnhb
										<td width="78%" class="vtable">
1188
											<select name="gateway" class="formselect" id="gateway">
1189 136c598d Carlos Eduardo Ramos
												<option value="none" selected><?=gettext("None"); ?></option>
1190 9978e156 gnhb
													<?php
1191 30ade846 gnhb
													if(count($a_gateways) > 0) {
1192
														foreach ($a_gateways as $gateway) {
1193
															if($gateway['interface'] == $if) {
1194 9978e156 gnhb
													?>
1195 30ade846 gnhb
															<option value="<?=$gateway['name'];?>" <?php if ($gateway['name'] == $pconfig['gateway']) echo "selected"; ?>>
1196
																<?=htmlspecialchars($gateway['name']) . " - " . htmlspecialchars($gateway['gateway']);?>
1197
															</option>
1198
													<?php
1199
															}
1200
														}
1201
													}
1202
													?>
1203 b9bbae04 jim-p
											</select> -or- <a OnClick="show_add_gateway();" href="#"><?=gettext("add a new one."); ?></a>
1204 30ade846 gnhb
											<br/>
1205
											<div id='addgwbox'>
1206 b9bbae04 jim-p
												<?=gettext("If this interface is an Internet connection, select an existing Gateway from the list or add one using the link above"); ?>
1207 30ade846 gnhb
											</div>
1208
											<div id='notebox'>
1209
											</div>
1210
											<div id="status">
1211 c0948c6c Renato Botelho
											</div>
1212 30ade846 gnhb
											<div style="display:none" id="addgateway" name="addgateway">
1213 c0948c6c Renato Botelho
												<p>
1214 30ade846 gnhb
												<table border="1" style="background:#990000; border-style: none none none none; width:225px;">
1215 9978e156 gnhb
													<tr>
1216 30ade846 gnhb
														<td>
1217
															<table bgcolor="#990000" cellpadding="1" cellspacing="1">
1218
																<tr><td>&nbsp;</td>
1219
																<tr>
1220 933ea015 Carlos Eduardo Ramos
																	<td colspan="2"><center><b><font color="white"><?=gettext("Add new gateway:"); ?></font></b></center></td>
1221 30ade846 gnhb
																</tr>
1222
																<tr><td>&nbsp;</td>
1223
																<?php
1224
																if($if == "wan" || $if == "WAN")
1225
																	$checked = " CHECKED";
1226
																?>
1227
																<tr>
1228 933ea015 Carlos Eduardo Ramos
																	<td width="45%" align="right"><font color="white"><?=gettext("Default  gateway:"); ?></td><td><input type="checkbox" id="defaultgw" name="defaultgw"<?=$checked?>></td>
1229 c0948c6c Renato Botelho
																</tr>
1230 30ade846 gnhb
																<tr>
1231 933ea015 Carlos Eduardo Ramos
																	<td align="right"><font color="white"><?=gettext("Gateway Name:"); ?></td><td><input id="name" name="name" value="<?=$wancfg['descr'] . "GW"?>"></td>
1232 30ade846 gnhb
																</tr>
1233
																<tr>
1234 933ea015 Carlos Eduardo Ramos
																	<td align="right"><font color="white"><?=gettext("Gateway IP:"); ?></td><td><input id="gatewayip" name="gatewayip"></td>
1235 30ade846 gnhb
																</tr>
1236
																<tr>
1237 933ea015 Carlos Eduardo Ramos
																	<td align="right"><font color="white"><?=gettext("Description:"); ?></td><td><input id="gatewaydescr" name="gatewaydescr"></td>
1238 30ade846 gnhb
																</tr>
1239
																<tr><td>&nbsp;</td>
1240
																<tr>
1241 7b8db0c3 Erik Fonnesbeck
																	<td>&nbsp;</td>
1242
																	<td>
1243 30ade846 gnhb
																		<center>
1244
																			<div id='savebuttondiv'>
1245
																				<input type="hidden" name="addrtype" id="addrtype" value="IPv4" />
1246 c0948c6c Renato Botelho
																				<input id="gwsave" type="Button" value="<?=gettext("Save Gateway"); ?>" onClick='hide_add_gatewaysave();'>
1247 136c598d Carlos Eduardo Ramos
																				<input id="gwcancel" type="Button" value="<?=gettext("Cancel"); ?>" onClick='hide_add_gateway();'>
1248 30ade846 gnhb
																			</div>
1249
																		</center>
1250
																	</td>
1251
																</tr>
1252 93ee6323 gnhb
																<tr><td>&nbsp;</td></tr>
1253 30ade846 gnhb
															</table>
1254 9978e156 gnhb
														</td>
1255
													</tr>
1256
												</table>
1257 30ade846 gnhb
												<p/>
1258
											</div>
1259
										</td>
1260
									</tr>
1261
								</table>
1262
							</td>
1263
						</tr>
1264
						<tr style="display:none;" name="dhcp" id="dhcp">
1265
							<td colspan="2" style="padding: 0px;">
1266
								<table width="100%" border="0" cellpadding="6" cellspacing="0">
1267
									<tr>
1268 136c598d Carlos Eduardo Ramos
										<td colspan="2" valign="top" class="listtopic"><?=gettext("DHCP client configuration"); ?></td>
1269 30ade846 gnhb
									</tr>
1270 e4d40f41 gnhb
									<!-- Uncomment to expose DHCP+ in GUI
1271
									<tr>
1272
										<td width="22%" valign="top" class="vncell"><?=gettext("Enable DHCP+"); ?></td>
1273
										<td width="78%" class="vtable">
1274
											<input name="dhcp_plus" type="checkbox" value="yes" <?php if ($pconfig['dhcp_plus'] == true) echo "checked"; ?> >
1275
										<strong><?=gettext("Enable DHCP+L2TP or DHCP+PPTP."); ?></strong>
1276
										<br/>
1277
										<?=gettext("Status changes on this interface will trigger reconfiguration (if necessary) of the associated PPTP/L2TP link."); ?>
1278
										</td>
1279
									</tr>
1280
									-->
1281 30ade846 gnhb
									<tr>
1282 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Hostname"); ?></td>
1283 30ade846 gnhb
										<td width="78%" class="vtable">
1284
											<input name="dhcphostname" type="text" class="formfld unknown" id="dhcphostname" size="40" value="<?=htmlspecialchars($pconfig['dhcphostname']);?>">
1285
											<br>
1286 136c598d Carlos Eduardo Ramos
											<?=gettext("The value in this field is sent as the DHCP client identifier " .
1287
											"and hostname when requesting a DHCP lease. Some ISPs may require " .
1288 933ea015 Carlos Eduardo Ramos
											"this (for client identification)."); ?>
1289 30ade846 gnhb
										</td>
1290
									</tr>
1291
									<tr>
1292 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Alias IP address"); ?></td>
1293 c0948c6c Renato Botelho
										<td width="78%" class="vtable">
1294 30ade846 gnhb
											<input name="alias-address" type="text" class="formfld unknown" id="alias-address" size="20" value="<?=htmlspecialchars($pconfig['alias-address']);?>">
1295
											<select name="alias-subnet" class="formselect" id="alias-subnet">
1296
												<?php
1297
												for ($i = 32; $i > 0; $i--) {
1298
													if($i <> 31) {
1299
														echo "<option value=\"{$i}\" ";
1300
														if ($i == $pconfig['alias-subnet']) echo "selected";
1301
														echo ">" . $i . "</option>";
1302
													}
1303
												}
1304
												?>
1305
											</select>
1306 136c598d Carlos Eduardo Ramos
											<?=gettext("The value in this field is used as a fixed alias IP address by the " .
1307 933ea015 Carlos Eduardo Ramos
											"DHCP client."); ?>
1308 30ade846 gnhb
										</td>
1309
									</tr>
1310 e4d40f41 gnhb
									
1311 30ade846 gnhb
								</table>
1312
							</td>
1313
						</tr>
1314 6c05cfb0 gnhb
						<tr style="display:none;" name="ppp" id="ppp">
1315
							<td colspan="2" style="padding: 0px;">
1316
								<table width="100%" border="0" cellpadding="6" cellspacing="0">
1317
									<tr>
1318 136c598d Carlos Eduardo Ramos
										<td colspan="2" valign="top" class="listtopic"><?=gettext("PPP configuration"); ?></td>
1319 6c05cfb0 gnhb
									</tr>
1320 3a906378 gnhb
									<tr name="ppp_provider" id="ppp_provider">
1321 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Service Provider"); ?></td>
1322 3a906378 gnhb
										<td width="78%" class="vtable">
1323
											<table border="0" cellpadding="0" cellspacing="0">
1324
												<tr id="trcountry">
1325 933ea015 Carlos Eduardo Ramos
													<td><?=gettext("Country:"); ?> &nbsp;&nbsp;</td>
1326 3a906378 gnhb
													<td>
1327
														<select class="formselect" name="country" id="country" onChange="providers_list()">
1328
															<option></option>
1329
														</select>
1330
													</td>
1331
												</tr>
1332
												<tr id="trprovider" style="display:none">
1333 933ea015 Carlos Eduardo Ramos
													<td><?=gettext("Provider:"); ?> &nbsp;&nbsp;</td>
1334 3a906378 gnhb
													<td>
1335
														<select class="formselect" name="provider" id="provider" onChange="providerplan_list()">
1336
															<option></option>
1337
														</select>
1338
													</td>
1339
												</tr>
1340
												<tr id="trproviderplan" style="display:none">
1341 933ea015 Carlos Eduardo Ramos
													<td><?=gettext("Plan:"); ?> &nbsp;&nbsp;</td>
1342 3a906378 gnhb
													<td>
1343
														<select class="formselect" name="providerplan" id="providerplan" onChange="prefill_provider()">
1344
															<option></option>
1345
														</select>
1346
													</td>
1347
												</tr>
1348
											</table>
1349 136c598d Carlos Eduardo Ramos
											<br/><span class="vexpl"><?=gettext("Select to fill in data for your service provider."); ?></span>
1350 3a906378 gnhb
										</td>
1351
									</tr>
1352 6c05cfb0 gnhb
									<tr>
1353 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Username"); ?></td>
1354 3a906378 gnhb
										<td width="78%" class="vtable">
1355
										<input name="username" type="text" class="formfld user" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>">
1356
										</td>
1357
									</tr>
1358
									<tr>
1359 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Password"); ?></td>
1360 3a906378 gnhb
										<td width="78%" class="vtable">
1361
										<input name="password" type="password" class="formfld pwd" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>">
1362
										</td>
1363
									</tr>
1364
									<tr name="phone_num" id="phone_num">
1365 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Phone Number"); ?></td>
1366 3a906378 gnhb
										<td width="78%" class="vtable">
1367
											<input name="phone" type="text" class="formfld unknown" id="phone" size="12" value="<?=htmlspecialchars($pconfig['phone']);?>">
1368
										</td>
1369
									</tr>
1370
									<tr name="apn_" id="apn_">
1371 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Access Point Name (APN)"); ?></td>
1372 3a906378 gnhb
										<td width="78%" class="vtable">
1373
											<input name="apn" type="text" class="formfld unknown" id="apn" size="40" value="<?=htmlspecialchars($pconfig['apn']);?>">
1374
										</td>
1375
									</tr>
1376
									<tr name="interface" id="interface" >
1377 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Modem Port"); ?></td>
1378 3a906378 gnhb
										<td width="78%" class="vtable">
1379
											<select name="port" id="port" class="formselect">
1380
											<?php
1381
												$portlist = glob("/dev/cua*");
1382
												$modems = glob("/dev/modem*");
1383
												$portlist = array_merge($portlist, $modems);
1384
												foreach ($portlist as $port) {
1385
													if(preg_match("/\.(lock|init)$/", $port))
1386
														continue;
1387
													echo "<option value=\"".trim($port)."\"";
1388
													if ($pconfig['port'] == $port)
1389
														echo "selected";
1390
													echo ">{$port}</option>";
1391
												}?>
1392
											</select>
1393
										</td>
1394
									</tr>
1395 136c598d Carlos Eduardo Ramos
									<td width="22%" valign="top" class="vncell"><?=gettext("Advanced PPP"); ?></td>
1396 6c05cfb0 gnhb
										<?php if (isset($pconfig['pppid'])): ?>
1397
											<td width="78%" class="vtable">
1398 933ea015 Carlos Eduardo Ramos
											<a href="/interfaces_ppps_edit.php?id=<?=htmlspecialchars($pconfig['pppid']);?>" class="navlnk"><?=gettext("Click here"); ?> </a>
1399
											<?=gettext("to edit PPP configuration."); ?>
1400 6c05cfb0 gnhb
											</td>
1401 ee9933b6 Renato Botelho
										<?php else: ?>
1402 6c05cfb0 gnhb
											<td width="78%" class="vtable">
1403 933ea015 Carlos Eduardo Ramos
											<a href="/interfaces_ppps_edit.php" class="navlnk"><?=gettext("Click here"); ?> </a>
1404
											<?=gettext("to create a PPP configuration."); ?>
1405 6c05cfb0 gnhb
											</td>
1406 c0948c6c Renato Botelho
										<?php endif; ?>
1407 6c05cfb0 gnhb
									</tr>
1408
								</table>
1409
							</td>
1410
						</tr>
1411 30ade846 gnhb
						<tr style="display:none;" name="pppoe" id="pppoe">
1412
							<td colspan="2" style="padding:0px;">
1413
								<table width="100%" border="0" cellpadding="6" cellspacing="0">
1414
									<tr>
1415 136c598d Carlos Eduardo Ramos
										<td colspan="2" valign="top" class="listtopic"><?=gettext("PPPoE configuration"); ?></td>
1416 30ade846 gnhb
									</tr>
1417
									<tr>
1418 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Username"); ?></td>
1419 30ade846 gnhb
										<td width="78%" class="vtable">
1420
												<input name="pppoe_username" type="text" class="formfld user" id="pppoe_username" size="20" value="<?=htmlspecialchars($pconfig['pppoe_username']);?>">
1421
										</td>
1422
									</tr>
1423
									<tr>
1424 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Password"); ?></td>
1425 30ade846 gnhb
										<td width="78%" class="vtable">
1426
											<input name="pppoe_password" type="password" class="formfld pwd" id="pppoe_password" size="20" value="<?=htmlspecialchars($pconfig['pppoe_password']);?>">
1427
										</td>
1428
									</tr>
1429
									<tr>
1430 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Service name"); ?></td>
1431 30ade846 gnhb
										<td width="78%" class="vtable"><input name="provider" type="text" class="formfld unknown" id="provider" size="20" value="<?=htmlspecialchars($pconfig['provider']);?>">
1432 136c598d Carlos Eduardo Ramos
											<br> <span class="vexpl"><?=gettext("Hint: this field can usually be left empty"); ?></span>
1433 30ade846 gnhb
										</td>
1434
									</tr>
1435
									<tr>
1436 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Dial on demand"); ?></td>
1437 30ade846 gnhb
										<td width="78%" class="vtable">
1438
											<input name="pppoe_dialondemand" type="checkbox" id="pppoe_dialondemand" value="enable" <?php if ($pconfig['pppoe_dialondemand']) echo "checked"; ?>>
1439 136c598d Carlos Eduardo Ramos
											<strong><?=gettext("Enable Dial-On-Demand mode"); ?></strong><br>
1440 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."); ?>
1441 30ade846 gnhb
										</td>
1442
									</tr>
1443
									<tr>
1444 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Idle timeout"); ?></td>
1445 30ade846 gnhb
										<td width="78%" class="vtable">
1446 933ea015 Carlos Eduardo Ramos
											<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."); ?>
1447 30ade846 gnhb
										</td>
1448
									</tr>
1449
									<tr>
1450
										<td width="22%" valign="top" class="vncell"><?=gettext("Periodic reset");?></td>
1451
										<td width="78%" class="vtable">
1452
											<table id="presetwrap" cellspacing="0" cellpadding="0" width="100%">
1453
												<tr>
1454
													<td align="left" valign="top">
1455
														<p style="margin: 4px; padding: 4px 0 4px 0; width: 94%;">
1456
														<select valign="top" id="reset_type" name="pppoe-reset-type" class="formselect" onChange="show_reset_settings(this.value);">
1457 136c598d Carlos Eduardo Ramos
															<option value = ""><?=gettext("Disabled"); ?></option>
1458
															<option value="custom" <?php if ($pconfig['pppoe-reset-type'] == "custom") echo "selected"; ?>><?=gettext("Custom"); ?></option>
1459
															<option value="preset" <?php if ($pconfig['pppoe-reset-type'] == "preset") echo "selected"; ?>><?=gettext("Pre-Set"); ?></option>
1460
														</select> <?=gettext("Select a reset timing type"); ?>
1461 30ade846 gnhb
														</p>
1462
														<?php if ($pconfig['pppoe_pr_custom']): ?>
1463
															<p style="margin: 2px; padding: 4px; width: 94%;" id="pppoecustomwrap">
1464
														<?php else: ?>
1465
															<p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoecustomwrap">
1466
														<?php endif; ?>
1467 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" />
1468 136c598d Carlos Eduardo Ramos
														<?=gettext("hour (0-23)"); ?><br />
1469 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" />
1470 136c598d Carlos Eduardo Ramos
														<?=gettext("minute (0-59)"); ?><br />
1471 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']);?>" />
1472 136c598d Carlos Eduardo Ramos
														<?=gettext("reset at a specific date (mm/dd/yyyy)"); ?>
1473 30ade846 gnhb
														<br />&nbsp;<br />
1474 933ea015 Carlos Eduardo Ramos
														<span class="red"><strong><?=gettext("Note:"); ?> </strong></span>
1475 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."); ?>
1476 30ade846 gnhb
														</p>
1477
														<?php if ($pconfig['pppoe_pr_preset']): ?>
1478
															<p style="margin: 2px; padding: 4px; width: 94%;" id="pppoepresetwrap">
1479
														<?php else: ?>
1480
															<p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoepresetwrap">
1481
														<?php endif; ?>
1482 c0948c6c Renato Botelho
														<input name="pppoe_pr_preset_val" type="radio" id="pppoe_monthly" value="monthly" <?php if ($pconfig['pppoe_monthly']) echo "checked=\"checked\""; ?> />
1483 136c598d Carlos Eduardo Ramos
														<?=gettext("reset at each month ('0 0 1 * *')"); ?>
1484 30ade846 gnhb
														<br />
1485 c0948c6c Renato Botelho
														<input name="pppoe_pr_preset_val" type="radio" id="pppoe_weekly" value="weekly" <?php if ($pconfig['pppoe_weekly']) echo "checked=\"checked\""; ?> />
1486 136c598d Carlos Eduardo Ramos
														<?=gettext("reset at each week ('0 0 * * 0')"); ?>
1487 30ade846 gnhb
														<br />
1488 c0948c6c Renato Botelho
														<input name="pppoe_pr_preset_val" type="radio" id="pppoe_daily" value="daily" <?php if ($pconfig['pppoe_daily']) echo "checked=\"checked\""; ?> />
1489 136c598d Carlos Eduardo Ramos
														<?=gettext("reset at each day ('0 0 * * *')"); ?>
1490 30ade846 gnhb
														<br />
1491 c0948c6c Renato Botelho
														<input name="pppoe_pr_preset_val" type="radio" id="pppoe_hourly" value="hourly" <?php if ($pconfig['pppoe_hourly']) echo "checked=\"checked\""; ?> />
1492 136c598d Carlos Eduardo Ramos
														<?=gettext("reset at each hour ('0 * * * *')"); ?>
1493 30ade846 gnhb
														</p>
1494
													</td>
1495
												</tr>
1496
											</table>
1497
										</td>
1498
									</tr>
1499 c0948c6c Renato Botelho
1500 30ade846 gnhb
									<tr>
1501 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Advanced and MLPPP"); ?></td>
1502 30ade846 gnhb
										<?php if (isset($pconfig['pppid'])): ?>
1503 09637075 gnhb
											<td width="78%" class="vtable">
1504 c0948c6c Renato Botelho
											<a href="/interfaces_ppps_edit.php?id=<?=htmlspecialchars($pconfig['pppid']);?>" class="navlnk"><?=gettext("Click here"); ?> </a>
1505 933ea015 Carlos Eduardo Ramos
											<?=gettext("for additional PPPoE configuration options. Save first if you made changes."); ?>
1506 9978e156 gnhb
											</td>
1507 ee9933b6 Renato Botelho
										<?php else: ?>
1508 09637075 gnhb
											<td width="78%" class="vtable">
1509 136c598d Carlos Eduardo Ramos
											<a href="/interfaces_ppps_edit.php" class="navlnk"><?=gettext("Click here"); ?> </a>
1510 933ea015 Carlos Eduardo Ramos
											<?=gettext("for advanced PPPoE configuration options and MLPPP configuration."); ?>
1511 30ade846 gnhb
											</td>
1512 c0948c6c Renato Botelho
										<?php endif; ?>
1513 30ade846 gnhb
									</tr>
1514
								</table>
1515 87f0be87 Chris Buechler
							</td>
1516 667a3184 Scott Ullrich
						</tr>
1517 30ade846 gnhb
						<tr style="display:none;" name="pptp" id="pptp">
1518
							<td colspan="2" style="padding:0px;">
1519
								<table width="100%" border="0" cellpadding="6" cellspacing="0">
1520
									<tr>
1521 e4d40f41 gnhb
										<td colspan="2" valign="top" class="listtopic"><?=gettext("PPTP/L2TP configuration"); ?></td>
1522 30ade846 gnhb
									</tr>
1523
									<tr>
1524 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Username"); ?></td>
1525 30ade846 gnhb
										<td width="78%" class="vtable">
1526
											<input name="pptp_username" type="text" class="formfld user" id="pptp_username" size="20" value="<?=htmlspecialchars($pconfig['pptp_username']);?>">
1527
										</td>
1528
									</tr>
1529
									<tr>
1530 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Password"); ?></td>
1531 30ade846 gnhb
										<td width="78%" class="vtable">
1532 4a1ee8ac gnhb
											<input name="pptp_password" type="password" class="formfld pwd" id="pptp_password" size="20" value="<?=htmlspecialchars($pconfig['pptp_password']);?>">
1533 30ade846 gnhb
										</td>
1534
									</tr>
1535
									<tr>
1536 136c598d Carlos Eduardo Ramos
										<td width="22%" width="100" valign="top" class="vncellreq"><?=gettext("Local IP address"); ?></td>
1537 c0948c6c Renato Botelho
										<td width="78%" class="vtable">
1538 4a1ee8ac gnhb
											<input name="pptp_local" type="text" class="formfld unknown" id="pptp_local" size="20"  value="<?=htmlspecialchars($pconfig['pptp_local'][0]);?>">
1539 30ade846 gnhb
											/
1540
											<select name="pptp_subnet" class="formselect" id="pptp_subnet">
1541
												<?php for ($i = 31; $i > 0; $i--): ?>
1542 4a1ee8ac gnhb
													<option value="<?=$i;?>" <?php if ($i == $pconfig['pptp_subnet'][0]) echo "selected"; ?>>
1543 30ade846 gnhb
														<?=$i;?></option>
1544
												<?php endfor; ?>
1545
											</select>
1546
										</td>
1547
									</tr>
1548
									<tr>
1549 136c598d Carlos Eduardo Ramos
										<td width="22%" width="100" valign="top" class="vncellreq"><?=gettext("Remote IP address"); ?></td>
1550 30ade846 gnhb
										<td width="78%" class="vtable">
1551 4a1ee8ac gnhb
											<input name="pptp_remote" type="text" class="formfld unknown" id="pptp_remote" size="20" value="<?=htmlspecialchars($pconfig['pptp_remote'][0]);?>">
1552 30ade846 gnhb
										</td>
1553
									</tr>
1554
									<tr>
1555 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Dial on demand"); ?></td>
1556 30ade846 gnhb
										<td width="78%" class="vtable">
1557
											<input name="pptp_dialondemand" type="checkbox" id="pptp_dialondemand" value="enable" <?php if ($pconfig['pptp_dialondemand']) echo "checked"; ?>>
1558 136c598d Carlos Eduardo Ramos
											<strong><?=gettext("Enable Dial-On-Demand mode"); ?></strong><br>
1559 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."); ?>
1560 30ade846 gnhb
										</td>
1561
									</tr>
1562
									<tr>
1563 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Idle timeout"); ?></td>
1564 30ade846 gnhb
										<td width="78%" class="vtable">
1565 933ea015 Carlos Eduardo Ramos
											<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."); ?>
1566 30ade846 gnhb
										</td>
1567
									</tr>
1568 4a1ee8ac gnhb
									<tr>
1569 136c598d Carlos Eduardo Ramos
										<td width="22%" valign="top" class="vncell"><?=gettext("Advanced"); ?></td>
1570 4a1ee8ac gnhb
										<?php if (isset($pconfig['pppid'])): ?>
1571
											<td width="78%" class="vtable">
1572 c0948c6c Renato Botelho
											<a href="/interfaces_ppps_edit.php?id=<?=htmlspecialchars($pconfig['pppid']);?>" class="navlnk"><?=gettext("Click here");?></a>
1573 933ea015 Carlos Eduardo Ramos
											<?=gettext("for additional PPTP and L2TP configuration options. Save first if you made changes.");?>
1574 4a1ee8ac gnhb
											</td>
1575 ee9933b6 Renato Botelho
										<?php else: ?>
1576 4a1ee8ac gnhb
											<td width="78%" class="vtable">
1577 4256d115 Renato Botelho
											<a href="/interfaces_ppps_edit.php" class="navlnk"><?=gettext("Click here");?></a>
1578
											<?=gettext("for advanced PPTP and L2TP configuration options");?>.
1579 4a1ee8ac gnhb
											</td>
1580 c0948c6c Renato Botelho
										<?php endif; ?>
1581 4a1ee8ac gnhb
									</tr>
1582 30ade846 gnhb
								</table>
1583
							</td>
1584
						</tr>
1585
						<?php
1586
							/* Wireless interface? */
1587
							if (isset($wancfg['wireless'])):
1588
						?>
1589
						<tr>
1590
							<td colspan="2" valign="top" height="16"></td>
1591 c0948c6c Renato Botelho
						</tr>
1592 9978e156 gnhb
						<tr>
1593 136c598d Carlos Eduardo Ramos
							<td colspan="2" valign="top" class="listtopic"><?=gettext("Common wireless configuration - Settings apply to all wireless networks on"); ?> <?=$wlanbaseif;?>.</td>
1594 9978e156 gnhb
						</tr>
1595 f62c44d8 Erik Fonnesbeck
						<tr>
1596 4256d115 Renato Botelho
							<td valign="top" class="vncell"><?=gettext("Persist common settings");?></td>
1597 f62c44d8 Erik Fonnesbeck
							<td class="vtable">
1598 ee9933b6 Renato Botelho
								<input name="persistcommonwireless" type="checkbox" value="yes"  class="formfld" id="persistcommonwireless" <?php if ($pconfig['persistcommonwireless']) echo "checked";?>>
1599 933ea015 Carlos Eduardo Ramos
								<br/><?=gettext("Enabling this preserves the common wireless configuration through interface deletions and reassignments.");?>
1600 f62c44d8 Erik Fonnesbeck
							</td>
1601
						</tr>
1602 9978e156 gnhb
						<tr>
1603 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncellreq"><?=gettext("Standard"); ?></td>
1604 30ade846 gnhb
							<td class="vtable">
1605 3a13f094 gnhb
							<select name="standard" class="formselect" id="standard">
1606
								<?php
1607
								foreach($wl_modes as $wl_standard => $wl_channels) {
1608
									echo "<option ";
1609
									if ($pconfig['standard'] == "$wl_standard")
1610
										echo "selected ";
1611
									echo "value=\"$wl_standard\">802.$wl_standard</option>\n";
1612
								}
1613
								?>
1614
							</select>
1615 30ade846 gnhb
							</td>
1616
						</tr>
1617
						<?php if (isset($wl_modes['11g'])): ?>
1618
						<tr>
1619 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncellreq">802.11g OFDM <?=gettext("Protection Mode"); ?></td>
1620 30ade846 gnhb
							<td class="vtable">
1621
								<select name="protmode" class="formselect" id="protmode">
1622 ee9933b6 Renato Botelho
									<option <?php if ($pconfig['protmode'] == 'off') echo "selected";?> value="off"><?=gettext("Protection mode off"); ?></option>
1623
									<option <?php if ($pconfig['protmode'] == 'cts') echo "selected";?> value="cts"><?=gettext("Protection mode CTS to self"); ?></option>
1624
									<option <?php if ($pconfig['protmode'] == 'rtscts') echo "selected";?> value="rtscts"><?=gettext("Protection mode RTS and CTS"); ?></option>
1625 30ade846 gnhb
								</select>
1626
								<br/>
1627 933ea015 Carlos Eduardo Ramos
								<?=gettext("For IEEE 802.11g, use the specified technique for protecting OFDM frames in a mixed 11b/11g network."); ?>
1628 30ade846 gnhb
								<br/>
1629
							</td>
1630
						</tr>
1631
						<?php else: ?>
1632
						<input name="protmode" type="hidden" id="protmode" value="off">
1633
						<?php endif; ?>
1634
						<tr>
1635 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncellreq"><?=gettext("Transmit power"); ?></td>
1636 30ade846 gnhb
							<td class="vtable">
1637
								<select name="txpower" class="formselect" id="txpower">
1638
									<?
1639
									for($x = 99; $x > 0; $x--) {
1640
										if($pconfig["txpower"] == $x)
1641
											$SELECTED = " SELECTED";
1642
										else
1643
											$SELECTED = "";
1644
										echo "<option {$SELECTED}>{$x}</option>\n";
1645
									}
1646
									?>
1647
								</select><br/>
1648 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."); ?>
1649 9978e156 gnhb
							</td>
1650
						</tr>
1651
						<tr>
1652 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncellreq"><?=gettext("Channel"); ?></td>
1653 30ade846 gnhb
							<td class="vtable">
1654
								<select name="channel" class="formselect" id="channel">
1655 ee9933b6 Renato Botelho
									<option <?php if ($pconfig['channel'] == 0) echo "selected"; ?> value="0"><?=gettext("Auto"); ?></option>
1656 9978e156 gnhb
									<?php
1657 30ade846 gnhb
									foreach($wl_modes as $wl_standard => $wl_channels) {
1658
										if($wl_standard == "11g") { $wl_standard = "11b/g"; }
1659
										else if($wl_standard == "11ng") { $wl_standard = "11b/g/n"; }
1660
										else if($wl_standard == "11na") { $wl_standard = "11a/n"; }
1661
										foreach($wl_channels as $wl_channel) {
1662
											echo "<option ";
1663
											if ($pconfig['channel'] == "$wl_channel") {
1664
												echo "selected ";
1665
											}
1666
											echo "value=\"$wl_channel\">$wl_standard - $wl_channel";
1667
											if(isset($wl_chaninfo[$wl_channel]))
1668
												echo " ({$wl_chaninfo[$wl_channel][1]} @ {$wl_chaninfo[$wl_channel][2]} / {$wl_chaninfo[$wl_channel][3]})";
1669
											echo "</option>\n";
1670 d85ba87f gnhb
										}
1671 9978e156 gnhb
									}
1672
									?>
1673
								</select>
1674 30ade846 gnhb
								<br/>
1675 136c598d Carlos Eduardo Ramos
								<?=gettext("Legend: wireless standards - channel # (frequency @ max TX power / TX power allowed in reg. domain)"); ?>
1676 30ade846 gnhb
								<br/>
1677 933ea015 Carlos Eduardo Ramos
								<?=gettext("Note: Not all channels may be supported by your card.  Auto may override the wireless standard selected above."); ?>
1678 9978e156 gnhb
							</td>
1679
						</tr>
1680 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"])): ?>
1681
						<tr>
1682
							<td valign="top" class="vncell"><?=gettext("Antenna settings"); ?></td>
1683
							<td class="vtable">
1684
								<table border="0" cellpadding="0" cellspacing="0">
1685
									<tr>
1686
										<?php if (isset($wl_sysctl["{$wl_sysctl_prefix}.diversity"])): ?>
1687
										<td>
1688
											<?=gettext("Diversity"); ?><br/>
1689
											<select name="diversity" class="formselect" id="diversity">
1690 1930ccb6 Erik Fonnesbeck
												<option <?php if (!isset($pconfig['diversity'])) echo "selected"; ?> value=""><?=gettext("Default"); ?></option>
1691
												<option <?php if ($pconfig['diversity'] === '0') echo "selected"; ?> value="0"><?=gettext("Off"); ?></option>
1692
												<option <?php if ($pconfig['diversity'] === '1') echo "selected"; ?> value="1"><?=gettext("On"); ?></option>
1693 537bf7b3 Erik Fonnesbeck
											</select>
1694
										</td>
1695
										<td>&nbsp;&nbsp</td>
1696
										<?php endif; ?>
1697
										<?php if (isset($wl_sysctl["{$wl_sysctl_prefix}.txantenna"])): ?>
1698
										<td>
1699
											<?=gettext("Transmit antenna"); ?><br/>
1700
											<select name="txantenna" class="formselect" id="txantenna">
1701 1930ccb6 Erik Fonnesbeck
												<option <?php if (!isset($pconfig['txantenna'])) echo "selected"; ?> value=""><?=gettext("Default"); ?></option>
1702
												<option <?php if ($pconfig['txantenna'] === '0') echo "selected"; ?> value="0"><?=gettext("Auto"); ?></option>
1703
												<option <?php if ($pconfig['txantenna'] === '1') echo "selected"; ?> value="1"><?=gettext("#1"); ?></option>
1704
												<option <?php if ($pconfig['txantenna'] === '2') echo "selected"; ?> value="2"><?=gettext("#2"); ?></option>
1705 537bf7b3 Erik Fonnesbeck
											</select>
1706
										</td>
1707
										<td>&nbsp;&nbsp</td>
1708
										<?php endif; ?>
1709
										<?php if (isset($wl_sysctl["{$wl_sysctl_prefix}.rxantenna"])): ?>
1710
										<td>
1711
											<?=gettext("Receive antenna"); ?><br/>
1712
											<select name="rxantenna" class="formselect" id="rxantenna">
1713 1930ccb6 Erik Fonnesbeck
												<option <?php if (!isset($pconfig['rxantenna'])) echo "selected"; ?> value=""><?=gettext("Default"); ?></option>
1714
												<option <?php if ($pconfig['rxantenna'] === '0') echo "selected"; ?> value="0"><?=gettext("Auto"); ?></option>
1715
												<option <?php if ($pconfig['rxantenna'] === '1') echo "selected"; ?> value="1"><?=gettext("#1"); ?></option>
1716
												<option <?php if ($pconfig['rxantenna'] === '2') echo "selected"; ?> value="2"><?=gettext("#2"); ?></option>
1717 537bf7b3 Erik Fonnesbeck
											</select>
1718
										</td>
1719
										<?php endif; ?>
1720
									</tr>
1721
								</table>
1722
								<br/>
1723
								<?=gettext("Note: The antenna numbers do not always match up with the labels on the card."); ?>
1724
							</td>
1725
						</tr>
1726
						<?php endif; ?>
1727 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"])): ?>
1728 9978e156 gnhb
						<tr>
1729 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Distance setting"); ?></td>
1730 30ade846 gnhb
							<td class="vtable">
1731
								<input name="distance" type="text" class="formfld unknown" id="distance" size="5" value="<?=htmlspecialchars($pconfig['distance']);?>">
1732
								<br/>
1733 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/>
1734
								<?=gettext("(measured in Meters and works only for Atheros based cards !)"); ?>
1735 30ade846 gnhb
							</td>
1736 9978e156 gnhb
						</tr>
1737 6681fdd3 Erik Fonnesbeck
						<?php endif; ?>
1738 9978e156 gnhb
						<tr>
1739 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Regulatory settings"); ?></td>
1740 30ade846 gnhb
							<td class="vtable">
1741 136c598d Carlos Eduardo Ramos
								<?=gettext("Regulatory domain"); ?><br/>
1742 30ade846 gnhb
								<select name="regdomain" class="formselect" id="regdomain">
1743 ee9933b6 Renato Botelho
									<option <?php if (empty($pconfig['regdomain'])) echo "selected"; ?> value=""><?=gettext("Default"); ?></option>
1744 30ade846 gnhb
									<?php
1745
									foreach($wl_regdomains as $wl_regdomain_key => $wl_regdomain) {
1746
										echo "<option ";
1747
										if ($pconfig['regdomain'] == $wl_regdomains_attr[$wl_regdomain_key]['ID']) {
1748
											echo "selected ";
1749
										}
1750
										echo "value=\"{$wl_regdomains_attr[$wl_regdomain_key]['ID']}\">{$wl_regdomain['name']}</option>\n";
1751
									}
1752
									?>
1753
								</select>
1754
								<br/>
1755 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."); ?>
1756 30ade846 gnhb
								<br/><br/>
1757 136c598d Carlos Eduardo Ramos
								<?=gettext("Country (listed with country code and regulatory domain)"); ?><br/>
1758 30ade846 gnhb
								<select name="regcountry" class="formselect" id="regcountry">
1759 ee9933b6 Renato Botelho
									<option <?php if (empty($pconfig['regcountry'])) echo "selected"; ?> value=""><?=gettext("Default"); ?></option>
1760 30ade846 gnhb
									<?php
1761
									foreach($wl_countries as $wl_country_key => $wl_country) {
1762
										echo "<option ";
1763
										if ($pconfig['regcountry'] == $wl_countries_attr[$wl_country_key]['ID']) {
1764
											echo "selected ";
1765
										}
1766
										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";
1767
									}
1768
									?>
1769
								</select>
1770
								<br/>
1771 136c598d Carlos Eduardo Ramos
								<?=gettext("Note: Any country setting other than \"Default\" will override the regulatory domain setting"); ?>.
1772 30ade846 gnhb
								<br/><br/>
1773 136c598d Carlos Eduardo Ramos
								<?=gettext("Location"); ?><br/>
1774 30ade846 gnhb
								<select name="reglocation" class="formselect" id="reglocation">
1775 ee9933b6 Renato Botelho
									<option <?php if (empty($pconfig['reglocation'])) echo "selected"; ?> value=""><?=gettext("Default"); ?></option>
1776
									<option <?php if ($pconfig['reglocation'] == 'indoor') echo "selected"; ?> value="indoor"><?=gettext("Indoor"); ?></option>
1777
									<option <?php if ($pconfig['reglocation'] == 'outdoor') echo "selected"; ?> value="outdoor"><?=gettext("Outdoor"); ?></option>
1778
									<option <?php if ($pconfig['reglocation'] == 'anywhere') echo "selected"; ?> value="anywhere"><?=gettext("Anywhere"); ?></option>
1779 30ade846 gnhb
								</select>
1780
								<br/><br/>
1781 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."); ?>
1782 30ade846 gnhb
								<br/>
1783 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."); ?>
1784 9978e156 gnhb
							</td>
1785
						</tr>
1786
						<tr>
1787 30ade846 gnhb
							<td colspan="2" valign="top" height="16"></td>
1788 c0948c6c Renato Botelho
						</tr>
1789 30ade846 gnhb
						<tr>
1790 4256d115 Renato Botelho
							<td colspan="2" valign="top" class="listtopic"><?=gettext("Network-specific wireless configuration");?></td>
1791 30ade846 gnhb
						</tr>
1792
						<tr>
1793 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncellreq"><?=gettext("Mode"); ?></td>
1794 30ade846 gnhb
							<td class="vtable">
1795
								<select name="mode" class="formselect" id="mode">
1796 ee9933b6 Renato Botelho
									<option <?php if ($pconfig['mode'] == 'bss') echo "selected";?> value="bss"><?=gettext("Infrastructure (BSS)"); ?></option>
1797
									<option <?php if ($pconfig['mode'] == 'adhoc') echo "selected";?> value="adhoc"><?=gettext("Ad-hoc (IBSS)"); ?></option>
1798
									<option <?php if ($pconfig['mode'] == 'hostap') echo "selected";?> value="hostap"><?=gettext("Access Point"); ?></option>
1799 30ade846 gnhb
								</select>
1800 9978e156 gnhb
							</td>
1801
						</tr>
1802
						<tr>
1803 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncellreq"><?=gettext("SSID"); ?></td>
1804 30ade846 gnhb
							<td class="vtable">
1805
								<input name="ssid" type="text" class="formfld unknown" id="ssid" size="20" value="<?=htmlspecialchars($pconfig['ssid']); ?>">
1806 9978e156 gnhb
							</td>
1807
						</tr>
1808 30ade846 gnhb
						<?php if (isset($wl_modes['11ng']) || isset($wl_modes['11na'])): ?>
1809 9978e156 gnhb
						<tr>
1810 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Minimum wireless standard"); ?></td>
1811 30ade846 gnhb
							<td class="vtable">
1812
								<select name="puremode" class="formselect" id="puremode">
1813 ee9933b6 Renato Botelho
									<option <?php if ($pconfig['puremode'] == 'any') echo "selected";?> value="any"><?=gettext("Any"); ?></option>
1814 30ade846 gnhb
									<?php if (isset($wl_modes['11g'])): ?>
1815 ee9933b6 Renato Botelho
									<option <?php if ($pconfig['puremode'] == '11g') echo "selected";?> value="11g"><?=gettext("802.11g"); ?></option>
1816 30ade846 gnhb
									<?php endif; ?>
1817 ee9933b6 Renato Botelho
									<option <?php if ($pconfig['puremode'] == '11n') echo "selected";?> value="11n"><?=gettext("802.11n"); ?></option>
1818 30ade846 gnhb
								</select>
1819
								<br/>
1820 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)."); ?>
1821 9978e156 gnhb
							</td>
1822
						</tr>
1823 30ade846 gnhb
						<?php elseif (isset($wl_modes['11g'])): ?>
1824 9978e156 gnhb
						<tr>
1825 933ea015 Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("802.11g only"); ?></td>
1826 30ade846 gnhb
							<td class="vtable">
1827 ee9933b6 Renato Botelho
								<input name="puremode" type="checkbox" value="11g"  class="formfld" id="puremode" <?php if ($pconfig['puremode'] == '11g') echo "checked";?>>
1828 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)."); ?>
1829 9978e156 gnhb
							</td>
1830
						</tr>
1831 30ade846 gnhb
						<?php endif; ?>
1832 9978e156 gnhb
						<tr>
1833 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Allow intra-BSS communication"); ?></td>
1834 30ade846 gnhb
							<td class="vtable">
1835 ee9933b6 Renato Botelho
								<input name="apbridge_enable" type="checkbox" value="yes"  class="formfld" id="apbridge_enable" <?php if ($pconfig['apbridge_enable']) echo "checked";?>>
1836 30ade846 gnhb
								<br/>
1837 933ea015 Carlos Eduardo Ramos
								<?=gettext("When operating as an access point, enable this if you want to pass packets between wireless clients directly."); ?>
1838 30ade846 gnhb
								<br/>
1839 933ea015 Carlos Eduardo Ramos
								<?=gettext("Disabling the internal bridging is useful when traffic is to be processed with packet filtering."); ?>
1840 30ade846 gnhb
							</td>
1841
						</tr>
1842
						<tr>
1843 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Enable WME"); ?></td>
1844 30ade846 gnhb
							<td class="vtable">
1845 ee9933b6 Renato Botelho
								<input name="wme_enable" type="checkbox" class="formfld" id="wme_enable" value="yes" <?php if ($pconfig['wme_enable']) echo "checked";?>>
1846 933ea015 Carlos Eduardo Ramos
								<br/><?=gettext("Setting this option will force the card to use WME (wireless QoS)."); ?>
1847 30ade846 gnhb
							</td>
1848
						</tr>
1849
						<tr>
1850 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Enable Hide SSID"); ?></td>
1851 30ade846 gnhb
							<td class="vtable">
1852 ee9933b6 Renato Botelho
								<input name="hidessid_enable" type="checkbox" class="formfld" id="hidessid_enable" value="yes" <?php if ($pconfig['hidessid_enable']) echo "checked";?>>
1853 30ade846 gnhb
								<br/>
1854 136c598d Carlos Eduardo Ramos
								<?=gettext("Setting this option will force the card to NOT broadcast its SSID"); ?>
1855 30ade846 gnhb
								<br/>
1856 933ea015 Carlos Eduardo Ramos
								<?=gettext("(this might create problems for some clients)."); ?>
1857 30ade846 gnhb
							</td>
1858
						</tr>
1859
						<tr>
1860 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("WEP"); ?></td>
1861 c0948c6c Renato Botelho
							<td class="vtable">
1862 ee9933b6 Renato Botelho
								<input name="wep_enable" type="checkbox" id="wep_enable" value="yes" <?php if ($pconfig['wep_enable']) echo "checked"; ?>>
1863 136c598d Carlos Eduardo Ramos
								<strong><?=gettext("Enable WEP"); ?></strong>
1864 30ade846 gnhb
								<table border="0" cellspacing="0" cellpadding="0">
1865 9978e156 gnhb
									<tr>
1866 30ade846 gnhb
										<td>&nbsp;</td>
1867
										<td>&nbsp;</td>
1868 136c598d Carlos Eduardo Ramos
										<td>&nbsp;<?=gettext("TX key"); ?>&nbsp;</td>
1869 30ade846 gnhb
									</tr>
1870
									<tr>
1871 933ea015 Carlos Eduardo Ramos
										<td><?=gettext("Key 1:"); ?>&nbsp;&nbsp;</td>
1872 30ade846 gnhb
										<td>
1873
											<input name="key1" type="text" class="formfld unknown" id="key1" size="30" value="<?=htmlspecialchars($pconfig['key1']);?>">
1874
										</td>
1875
										<td align="center">
1876 ee9933b6 Renato Botelho
											<input name="txkey" type="radio" value="1" <?php if ($pconfig['txkey'] == 1) echo "checked";?>>
1877 30ade846 gnhb
										</td>
1878
									</tr>
1879
									<tr>
1880 933ea015 Carlos Eduardo Ramos
										<td><?=gettext("Key 2:"); ?>&nbsp;&nbsp;</td>
1881 30ade846 gnhb
										<td>
1882
											<input name="key2" type="text" class="formfld unknown" id="key2" size="30" value="<?=htmlspecialchars($pconfig['key2']);?>">
1883
										</td>
1884
										<td align="center">
1885 ee9933b6 Renato Botelho
											<input name="txkey" type="radio" value="2" <?php if ($pconfig['txkey'] == 2) echo "checked";?>>
1886 30ade846 gnhb
										</td>
1887
									</tr>
1888
									<tr>
1889 933ea015 Carlos Eduardo Ramos
										<td><?=gettext("Key 3:"); ?>&nbsp;&nbsp;</td>
1890 30ade846 gnhb
										<td>
1891
											<input name="key3" type="text" class="formfld unknown" id="key3" size="30" value="<?=htmlspecialchars($pconfig['key3']);?>">
1892
										</td>
1893
										<td align="center">
1894 ee9933b6 Renato Botelho
											<input name="txkey" type="radio" value="3" <?php if ($pconfig['txkey'] == 3) echo "checked";?>>
1895 30ade846 gnhb
										</td>
1896
									</tr>
1897
									<tr>
1898 933ea015 Carlos Eduardo Ramos
										<td><?=gettext("Key 4:"); ?>&nbsp;&nbsp;</td>
1899 30ade846 gnhb
										<td>
1900
											<input name="key4" type="text" class="formfld unknown" id="key4" size="30" value="<?=htmlspecialchars($pconfig['key4']);?>">
1901
										</td>
1902
										<td align="center">
1903 ee9933b6 Renato Botelho
											<input name="txkey" type="radio" value="4" <?php if ($pconfig['txkey'] == 4) echo "checked";?>>
1904 9978e156 gnhb
										</td>
1905
									</tr>
1906
								</table>
1907 30ade846 gnhb
								<br/>
1908 933ea015 Carlos Eduardo Ramos
								<?=gettext("40 (64) bit keys may be entered as 5 ASCII characters or 10 hex digits preceded by '0x'."); ?><br/>
1909
								<?=gettext("104 (128) bit keys may be entered as 13 ASCII characters or 26 hex digits preceded by '0x'."); ?>
1910 9978e156 gnhb
							</td>
1911
						</tr>
1912
						<tr>
1913 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("WPA"); ?></td>
1914 30ade846 gnhb
							<td class="vtable">
1915 ee9933b6 Renato Botelho
								<input name="wpa_enable" type="checkbox" class="formfld" id="wpa_enable" value="yes" <?php if ($pconfig['wpa_enable']) echo "checked"; ?>>
1916 136c598d Carlos Eduardo Ramos
								<strong><?=gettext("Enable WPA"); ?></strong>
1917 30ade846 gnhb
								<br/><br/>
1918
								<table border="0" cellspacing="0" cellpadding="0">
1919
									<tr>
1920
										<td>&nbsp;</td>
1921 136c598d Carlos Eduardo Ramos
										<td>&nbsp;<?=gettext("WPA Pre Shared Key"); ?>&nbsp;</td>
1922 30ade846 gnhb
									</tr>
1923
									<tr>
1924 933ea015 Carlos Eduardo Ramos
										<td><?=gettext("PSK:"); ?>&nbsp;&nbsp;</td>
1925 30ade846 gnhb
										<td>
1926
											<input name="passphrase" type="text" class="formfld unknown" id="passphrase" size="66" value="<?=htmlspecialchars($pconfig['passphrase']);?>">
1927
										</td>
1928
									</tr>
1929
								</table>
1930 933ea015 Carlos Eduardo Ramos
								<br/><?=gettext("Passphrase must be from 8 to 63 characters."); ?>
1931 30ade846 gnhb
							</td>
1932 9978e156 gnhb
						</tr>
1933
						<tr>
1934 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("WPA Mode"); ?></td>
1935 30ade846 gnhb
							<td class="vtable">
1936
								<select name="wpa_mode" class="formselect" id="wpa_mode">
1937 ee9933b6 Renato Botelho
									<option <?php if ($pconfig['wpa_mode'] == '1') echo "selected";?> value="1"><?=gettext("WPA"); ?></option>
1938
									<option <?php if ($pconfig['wpa_mode'] == '2') echo "selected";?> value="2"><?=gettext("WPA2"); ?></option>
1939
									<option <?php if ($pconfig['wpa_mode'] == '3') echo "selected";?> value="3"><?=gettext("Both"); ?></option>
1940 30ade846 gnhb
								</select>
1941 9978e156 gnhb
							</td>
1942
						</tr>
1943
						<tr>
1944 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("WPA Key Management Mode"); ?></td>
1945 c0948c6c Renato Botelho
							<td class="vtable">
1946 30ade846 gnhb
								<select name="wpa_key_mgmt" class="formselect" id="wpa_key_mgmt">
1947 ee9933b6 Renato Botelho
									<option <?php if ($pconfig['wpa_key_mgmt'] == 'WPA-PSK') echo "selected";?> value="WPA-PSK"><?=gettext("Pre Shared Key"); ?></option>
1948
									<option <?php if ($pconfig['wpa_key_mgmt'] == 'WPA-EAP') echo "selected";?> value="WPA-EAP"><?=gettext("Extensible Authentication Protocol"); ?></option>
1949
									<option <?php if ($pconfig['wpa_key_mgmt'] == 'WPA-PSK WPA-EAP') echo "selected";?> value="WPA-PSK WPA-EAP"><?=gettext("Both"); ?></option>
1950 30ade846 gnhb
								</select>
1951 9978e156 gnhb
							</td>
1952
						</tr>
1953
						<tr>
1954 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Authentication"); ?></td>
1955 30ade846 gnhb
							<td class="vtable">
1956
								<select name="auth_algs" class="formselect" id="auth_algs">
1957 ee9933b6 Renato Botelho
									<option <?php if ($pconfig['auth_algs'] == '1') echo "selected";?> value="1"><?=gettext("Open System Authentication"); ?></option>
1958
									<option <?php if ($pconfig['auth_algs'] == '2') echo "selected";?> value="2"><?=gettext("Shared Key Authentication"); ?></option>
1959
									<option <?php if ($pconfig['auth_algs'] == '3') echo "selected";?> value="3"><?=gettext("Both"); ?></option>
1960 9978e156 gnhb
								</select>
1961 933ea015 Carlos Eduardo Ramos
								<br/><?=gettext("Note: Shared Key Authentication requires WEP."); ?></br>
1962 9978e156 gnhb
							</td>
1963
						</tr>
1964
						<tr>
1965 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("WPA Pairwise"); ?></td>
1966 30ade846 gnhb
							<td class="vtable">
1967
								<select name="wpa_pairwise" class="formselect" id="wpa_pairwise">
1968 ee9933b6 Renato Botelho
									<option <?php if ($pconfig['wpa_pairwise'] == 'CCMP TKIP') echo "selected";?> value="CCMP TKIP"><?=gettext("Both"); ?></option>
1969
									<option <?php if ($pconfig['wpa_pairwise'] == 'CCMP') echo "selected";?> value="CCMP"><?=gettext("AES (recommended)"); ?></option>
1970
									<option <?php if ($pconfig['wpa_pairwise'] == 'TKIP') echo "selected";?> value="TKIP"><?=gettext("TKIP"); ?></option>
1971 30ade846 gnhb
								</select>
1972 9978e156 gnhb
							</td>
1973
						</tr>
1974
						<tr>
1975 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Key Rotation"); ?></td>
1976 30ade846 gnhb
							<td class="vtable">
1977 ee9933b6 Renato Botelho
								<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";?>">
1978 933ea015 Carlos Eduardo Ramos
								<br/><?=gettext("Allowed values are 1-9999 but should not be longer than Master Key Regeneration time."); ?>
1979 9978e156 gnhb
							</td>
1980
						</tr>
1981
						<tr>
1982 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Master Key Regeneration"); ?></td>
1983 30ade846 gnhb
							<td class="vtable">
1984 ee9933b6 Renato Botelho
								<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";?>">
1985 933ea015 Carlos Eduardo Ramos
								<br/><?=gettext("Allowed values are 1-9999 but should not be shorter than Key Rotation time."); ?>
1986 9978e156 gnhb
							</td>
1987
						</tr>
1988
						<tr>
1989 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Strict Key Regeneration"); ?></td>
1990 30ade846 gnhb
							<td class="vtable">
1991 ee9933b6 Renato Botelho
								<input name="wpa_strict_rekey" type="checkbox" value="yes"  class="formfld" id="wpa_strict_rekey" <?php if ($pconfig['wpa_strict_rekey']) echo "checked"; ?>>
1992 933ea015 Carlos Eduardo Ramos
								<br/><?=gettext("Setting this option will force the AP to rekey whenever a client disassociates."); ?>
1993 30ade846 gnhb
							</td>
1994 9978e156 gnhb
						</tr>
1995
						<tr>
1996 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("Enable IEEE802.1X Authentication"); ?></td>
1997 30ade846 gnhb
							<td class="vtable">
1998 ee9933b6 Renato Botelho
								<input name="ieee8021x" type="checkbox" value="yes"  class="formfld" id="ieee8021x" <?php if ($pconfig['ieee8021x']) echo "checked";?>>
1999 933ea015 Carlos Eduardo Ramos
								<br/><?=gettext("Setting this option will enable 802.1x authentication."); ?>
2000 10e4d55e Pierre POMES
								<br/><span class="red"><strong><?=gettext("NOTE"); ?>:</strong></span> <?=gettext("this option requires checking the \"Enable WPA box\"."); ?>
2001 9978e156 gnhb
							</td>
2002
						</tr>
2003
						<tr>
2004 136c598d Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("802.1X Authentication Server IP Address"); ?></td>
2005 30ade846 gnhb
							<td class="vtable">
2006
								<input name="auth_server_addr" id="auth_server_addr" type="text" class="formfld unknown" size="66" value="<?=htmlspecialchars($pconfig['auth_server_addr']);?>">
2007 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.)"); ?>
2008 9978e156 gnhb
							</td>
2009
						</tr>
2010
						<tr>
2011 933ea015 Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("802.1X Authentication Server Port"); ?></td>
2012 30ade846 gnhb
							<td class="vtable">
2013
								<input name="auth_server_port" id="auth_server_port" type="text" class="formfld unknown" size="66" value="<?=htmlspecialchars($pconfig['auth_server_port']);?>">
2014 933ea015 Carlos Eduardo Ramos
								<br/><?=gettext("Leave blank for the default 1812 port."); ?>
2015 9978e156 gnhb
							</td>
2016
						</tr>
2017
						<tr>
2018 933ea015 Carlos Eduardo Ramos
							<td valign="top" class="vncell"><?=gettext("802.1X Authentication Server Shared Secret"); ?></td>
2019 30ade846 gnhb
							<td class="vtable">
2020
								<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']);?>">
2021
								<br/>
2022 9978e156 gnhb
							</td>
2023 30ade846 gnhb
						</tr>
2024 c9e7d30d Scott Ullrich
						<tr>
2025
							<td valign="top" class="vncell">802.1X <?=gettext("Authentication Roaming Preauth"); ?></td>
2026
							<td class="vtable">
2027
								<input name="rsn_preauth" id="rsn_preauth" type="checkbox" class="formfld unknown" size="66" value="yes" <? if ($pconfig['rsn_preauth']) echo "checked"; ?>>
2028
								<br/>
2029
							</td>
2030
						</tr>
2031 ee9933b6 Renato Botelho
						<?php endif; ?>
2032 30ade846 gnhb
						<tr>
2033
							<td colspan="2" valign="top" height="16"></td>
2034
						</tr>
2035
						<tr>
2036 136c598d Carlos Eduardo Ramos
							<td colspan="2" valign="top" class="listtopic"><?=gettext("Private networks"); ?></td>
2037 30ade846 gnhb
						</tr>
2038
						<tr>
2039
							<td valign="middle" class="vncell">&nbsp;</td>
2040
							<td class="vtable">
2041 c0948c6c Renato Botelho
								<a name="rfc1918"></a>
2042 30ade846 gnhb
								<input name="blockpriv" type="checkbox" id="blockpriv" value="yes" <?php if ($pconfig['blockpriv']) echo "checked"; ?>>
2043 136c598d Carlos Eduardo Ramos
								<strong><?=gettext("Block private networks"); ?></strong><br>
2044
								<?=gettext("When set, this option blocks traffic from IP addresses that are reserved " .
2045
								"for private  networks as per RFC 1918 (10/8, 172.16/12, 192.168/16) as"); ?>
2046 933ea015 Carlos Eduardo Ramos
								<?=gettext("well as loopback addresses (127/8)."); ?>&nbsp;&nbsp; <?=gettext("You should generally " .
2047 136c598d Carlos Eduardo Ramos
								"leave this option turned on, unless your WAN network lies in such " .
2048 c0948c6c Renato Botelho
								"a private address space, too."); ?>
2049 9978e156 gnhb
							</td>
2050
						</tr>
2051
						<tr>
2052 30ade846 gnhb
							<td valign="middle" class="vncell">&nbsp;</td>
2053 c0948c6c Renato Botelho
							<td class="vtable">
2054 30ade846 gnhb
								<input name="blockbogons" type="checkbox" id="blockbogons" value="yes" <?php if ($pconfig['blockbogons']) echo "checked"; ?>>
2055 136c598d Carlos Eduardo Ramos
								<strong><?=gettext("Block bogon networks"); ?></strong><br>
2056
								<?=gettext("When set, this option blocks traffic from IP addresses that are reserved " .
2057 933ea015 Carlos Eduardo Ramos
								"(but not RFC 1918) or not yet assigned by IANA."); ?>&nbsp;&nbsp;
2058 136c598d Carlos Eduardo Ramos
								<?=gettext("Bogons are prefixes that should never appear in the Internet routing table, " .
2059 933ea015 Carlos Eduardo Ramos
								"and obviously should not appear as the source address in any packets you receive."); ?>
2060 30ade846 gnhb
							</td>
2061 9978e156 gnhb
						</tr>
2062 1600b1af Scott Ullrich
					</table> <!-- End "allcfg" table -->
2063
					</div> <!-- End "allcfg" div -->
2064
2065
					<table width="100%" border="0" cellpadding="6" cellspacing="0">
2066 9978e156 gnhb
						<tr>
2067 7b8db0c3 Erik Fonnesbeck
							<td width="22%" valign="top">
2068 30ade846 gnhb
								&nbsp;
2069
							</td>
2070 7b8db0c3 Erik Fonnesbeck
							<td width="78%">
2071 30ade846 gnhb
								<br/>
2072 c0948c6c Renato Botelho
								<input id="save" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>">
2073 136c598d Carlos Eduardo Ramos
								<input id="cancel" type="button" class="formbtn" value="<?=gettext("Cancel"); ?>" onclick="history.back()">
2074 30ade846 gnhb
								<input name="if" type="hidden" id="if" value="<?=$if;?>">
2075 1d7e1d6c gnhb
								<?php if ($wancfg['if'] == $a_ppps[$pppid]['if']) : ?>
2076 dd5bf424 Scott Ullrich
								<input name="ppp_port" type="hidden" value="<?=htmlspecialchars($pconfig['port']);?>">
2077 30ade846 gnhb
								<?php endif; ?>
2078 dd5bf424 Scott Ullrich
								<input name="ptpid" type="hidden" value="<?=htmlspecialchars($pconfig['ptpid']);?>">
2079 9978e156 gnhb
							</td>
2080
						</tr>
2081 1600b1af Scott Ullrich
					</table>
2082 9978e156 gnhb
				</td>
2083
			</tr>
2084
		</table>
2085 30ade846 gnhb
		<!--
2086 9978e156 gnhb
		</div>
2087
		</td></tr>
2088
		</table>
2089 30ade846 gnhb
		-->
2090 9978e156 gnhb
	</form>
2091 30ade846 gnhb
	<script type="text/javascript">
2092
		var gatewayip;
2093
		var name;
2094
		function show_add_gateway() {
2095
			document.getElementById("addgateway").style.display = '';
2096
			document.getElementById("addgwbox").style.display = 'none';
2097
			document.getElementById("gateway").style.display = 'none';
2098
			document.getElementById("save").style.display = 'none';
2099
			document.getElementById("cancel").style.display = 'none';
2100
			document.getElementById("gwsave").style.display = '';
2101
			document.getElementById("gwcancel").style.display = '';
2102
			$('notebox').innerHTML="";
2103
		}
2104
		function hide_add_gateway() {
2105
			document.getElementById("addgateway").style.display = 'none';
2106 c0948c6c Renato Botelho
			document.getElementById("addgwbox").style.display = '';
2107 30ade846 gnhb
			document.getElementById("gateway").style.display = '';
2108
			document.getElementById("save").style.display = '';
2109
			document.getElementById("cancel").style.display = '';
2110
			document.getElementById("gwsave").style.display = '';
2111
			document.getElementById("gwcancel").style.display = '';
2112
		}
2113
		function hide_add_gatewaysave() {
2114
			document.getElementById("addgateway").style.display = 'none';
2115
			$('status').innerHTML = '<img src="/themes/metallic/images/misc/loader.gif"> One moment please...';
2116
			var iface = $F('if');
2117
			name = $('name').getValue();
2118
			var descr = $('gatewaydescr').getValue();
2119
			gatewayip = $('gatewayip').getValue();
2120
			addrtype = $('addrtype').getValue();
2121
			var defaultgw = $('defaultgw').getValue();
2122
			var url = "system_gateways_edit.php";
2123
			var pars = 'isAjax=true&defaultgw=' + escape(defaultgw) + '&interface=' + escape(iface) + '&name=' + escape(name) + '&descr=' + escape(descr) + '&gateway=' + escape(gatewayip) + '&type=' + escape(addrtype);
2124
			var myAjax = new Ajax.Request(
2125
				url,
2126
				{
2127
					method: 'post',
2128
					parameters: pars,
2129
					onFailure: report_failure,
2130
					onComplete: save_callback
2131 c0948c6c Renato Botelho
				});
2132 30ade846 gnhb
		}
2133
		function addOption(selectbox,text,value)
2134
		{
2135
			var optn = document.createElement("OPTION");
2136
			optn.text = text;
2137
			optn.value = value;
2138
			selectbox.options.add(optn);
2139
			selectbox.selectedIndex = (selectbox.options.length-1);
2140 933ea015 Carlos Eduardo Ramos
			$('notebox').innerHTML="<p/><strong><?=gettext("NOTE:"); ?></strong> <?=gettext("You can manage Gateways"); ?> <a target='_new' href='system_gateways.php'><?=gettext("here"); ?></a>.";
2141 c0948c6c Renato Botelho
		}
2142 30ade846 gnhb
		function report_failure() {
2143
			alert("Sorry, we could not create your gateway at this time.");
2144
			hide_add_gateway();
2145
		}
2146
		function save_callback(transport) {
2147
			var response = transport.responseText;
2148
			if(response) {
2149
				document.getElementById("addgateway").style.display = 'none';
2150
				hide_add_gateway();
2151
				$('status').innerHTML = '';
2152
				addOption($('gateway'), name, name);
2153
				// Auto submit form?
2154
				//document.iform.submit();
2155
				//$('status').innerHTML = '<img src="/themes/metallic/images/misc/loader.gif">';
2156
			} else {
2157
				report_failure();
2158
			}
2159
		}
2160
		<?php
2161 8672329c Erik Fonnesbeck
		echo "show_allcfg(document.iform.enable);";
2162 30ade846 gnhb
		echo "updateType('{$pconfig['type']}');\n";
2163 6c05cfb0 gnhb
		?>
2164 30ade846 gnhb
	</script>
2165
	<?php include("fend.inc"); ?>
2166
	</body>
2167 b09a92b7 Ermal Luçi
</html>