1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
interfaces.php
|
5
|
Copyright (C) 2004-2008 Scott Ullrich
|
6
|
Copyright (C) 2006 Daniel S. Haischt.
|
7
|
Copyright (C) 2008 Ermal Lu?i
|
8
|
All rights reserved.
|
9
|
|
10
|
originally part of m0n0wall (http://m0n0.ch/wall)
|
11
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
12
|
All rights reserved.
|
13
|
|
14
|
Redistribution and use in source and binary forms, with or without
|
15
|
modification, are permitted provided that the following conditions are met:
|
16
|
|
17
|
1. Redistributions of source code must retain the above copyright notice,
|
18
|
this list of conditions and the following disclaimer.
|
19
|
|
20
|
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
|
|
24
|
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
|
/*
|
36
|
pfSense_BUILDER_BINARIES: /usr/sbin/arp
|
37
|
pfSense_MODULE: interfaces
|
38
|
*/
|
39
|
|
40
|
##|+PRIV
|
41
|
##|*IDENT=page-interfaces
|
42
|
##|*NAME=Interfaces: WAN page
|
43
|
##|*DESCR=Allow access to the 'Interfaces' page.
|
44
|
##|*MATCH=interfaces.php*
|
45
|
##|-PRIV
|
46
|
|
47
|
require("guiconfig.inc");
|
48
|
require("ipsec.inc");
|
49
|
require("functions.inc");
|
50
|
require("captiveportal.inc");
|
51
|
require("filter.inc");
|
52
|
require("shaper.inc");
|
53
|
require("rrd.inc");
|
54
|
require("vpn.inc");
|
55
|
|
56
|
if ($_REQUEST['if']) {
|
57
|
$if = $_REQUEST['if'];
|
58
|
} else {
|
59
|
$if = "wan";
|
60
|
}
|
61
|
|
62
|
define("CRON_PPPOE_CMD_FILE", "/conf/pppoe{$if}restart");
|
63
|
define("CRON_MONTHLY_PATTERN", "0 0 1 * *");
|
64
|
define("CRON_WEEKLY_PATTERN", "0 0 * * 0");
|
65
|
define("CRON_DAILY_PATTERN", "0 0 * * *");
|
66
|
define("CRON_HOURLY_PATTERN", "0 * * * *");
|
67
|
|
68
|
function getMPDCRONSettings() {
|
69
|
global $config;
|
70
|
if (is_array($config['cron']['item'])) {
|
71
|
for ($i = 0; $i < count($config['cron']['item']); $i++) {
|
72
|
$item = $config['cron']['item'][$i];
|
73
|
if (strpos($item['command'], CRON_PPPOE_CMD_FILE) !== false) {
|
74
|
return array("ID" => $i, "ITEM" => $item);
|
75
|
}
|
76
|
}
|
77
|
}
|
78
|
return NULL;
|
79
|
}
|
80
|
|
81
|
function getMPDResetTimeFromConfig() {
|
82
|
$itemhash = getMPDCRONSettings();
|
83
|
$cronitem = $itemhash['ITEM'];
|
84
|
if (isset($cronitem)) {
|
85
|
return "{$cronitem['minute']} {$cronitem['hour']} {$cronitem['mday']} {$cronitem['month']} {$cronitem['wday']}";
|
86
|
} else {
|
87
|
return NULL;
|
88
|
}
|
89
|
}
|
90
|
|
91
|
function remove_bad_chars($string) {
|
92
|
return preg_replace('/[^a-z|_|0-9]/i','',$string);
|
93
|
}
|
94
|
|
95
|
if (!is_array($config['gateways']['gateway_item']))
|
96
|
$config['gateways']['gateway_item'] = array();
|
97
|
|
98
|
$a_gateways = &$config['gateways']['gateway_item'];
|
99
|
|
100
|
$wancfg = &$config['interfaces'][$if];
|
101
|
|
102
|
$pconfig['pppoe_username'] = $wancfg['pppoe_username'];
|
103
|
$pconfig['pppoe_password'] = $wancfg['pppoe_password'];
|
104
|
$pconfig['provider'] = $wancfg['provider'];
|
105
|
$pconfig['pppoe_dialondemand'] = isset($wancfg['ondemand']);
|
106
|
$pconfig['pppoe_idletimeout'] = $wancfg['timeout'];
|
107
|
|
108
|
/* ================================================ */
|
109
|
/* = force a connection reset at a specific time? = */
|
110
|
/* ================================================ */
|
111
|
|
112
|
if (isset($wancfg['pppoe']['pppoe-reset-type'])) {
|
113
|
$resetTime = getMPDResetTimeFromConfig();
|
114
|
$pconfig['pppoe_preset'] = true;
|
115
|
if ($wancfg['pppoe']['pppoe-reset-type'] == "custom") {
|
116
|
$resetTime_a = split(" ", $resetTime);
|
117
|
$pconfig['pppoe_pr_custom'] = true;
|
118
|
$pconfig['pppoe_resetminute'] = $resetTime_a[0];
|
119
|
$pconfig['pppoe_resethour'] = $resetTime_a[1];
|
120
|
/* just initialize $pconfig['pppoe_resetdate'] if the
|
121
|
* coresponding item contains appropriate numeric values.
|
122
|
*/
|
123
|
if ($resetTime_a[2] <> "*" && $resetTime_a[3] <> "*")
|
124
|
$pconfig['pppoe_resetdate'] = "{$resetTime_a[3]}/{$resetTime_a[2]}/" . date("Y");
|
125
|
} else if ($wancfg['pppoe']['pppoe-reset-type'] == "preset") {
|
126
|
$pconfig['pppoe_pr_preset'] = true;
|
127
|
switch ($resetTime) {
|
128
|
case CRON_MONTHLY_PATTERN:
|
129
|
$pconfig['pppoe_monthly'] = true;
|
130
|
break;
|
131
|
case CRON_WEEKLY_PATTERN:
|
132
|
$pconfig['pppoe_weekly'] = true;
|
133
|
break;
|
134
|
case CRON_DAILY_PATTERN:
|
135
|
$pconfig['pppoe_daily'] = true;
|
136
|
break;
|
137
|
case CRON_HOURLY_PATTERN:
|
138
|
$pconfig['pppoe_hourly'] = true;
|
139
|
break;
|
140
|
}
|
141
|
}
|
142
|
}
|
143
|
|
144
|
$pconfig['pptp_username'] = $wancfg['pptp_username'];
|
145
|
$pconfig['pptp_password'] = $wancfg['pptp_password'];
|
146
|
$pconfig['pptp_local'] = $wancfg['local'];
|
147
|
$pconfig['pptp_subnet'] = $wancfg['subnet'];
|
148
|
$pconfig['pptp_remote'] = $wancfg['remote'];
|
149
|
$pconfig['pptp_dialondemand'] = isset($wancfg['ondemand']);
|
150
|
$pconfig['pptp_idletimeout'] = $wancfg['timeout'];
|
151
|
|
152
|
$pconfig['dhcphostname'] = $wancfg['dhcphostname'];
|
153
|
$pconfig['alias-address'] = $wancfg['alias-address'];
|
154
|
$pconfig['alias-subnet'] = $wancfg['alias-subnet'];
|
155
|
|
156
|
// Populate page descr if it does not exist.
|
157
|
if($if == "wan" && !$wancfg['descr']) {
|
158
|
$wancfg['descr'] = "WAN";
|
159
|
} else if ($if == "lan" && !$wancfg['descr']) {
|
160
|
$wancfg['descr'] = "LAN";
|
161
|
}
|
162
|
$pconfig['descr'] = remove_bad_chars($wancfg['descr']);
|
163
|
|
164
|
if ($if == "wan" || $if == "lan")
|
165
|
$pconfig['enable'] = true;
|
166
|
else
|
167
|
$pconfig['enable'] = isset($wancfg['enable']);
|
168
|
|
169
|
if (is_array($config['aliases']['alias'])) {
|
170
|
foreach($config['aliases']['alias'] as $alias) {
|
171
|
if($alias['name'] == $wancfg['descr']) {
|
172
|
$input_errors[] = gettext("Sorry, an alias with the name {$wancfg['descr']} already exists.");
|
173
|
}
|
174
|
}
|
175
|
}
|
176
|
|
177
|
switch($wancfg['ipaddr']) {
|
178
|
case "dhcp":
|
179
|
$pconfig['type'] = "dhcp";
|
180
|
break;
|
181
|
case "carpdev-dhcp":
|
182
|
$pconfig['type'] = "carpdev-dhcp";
|
183
|
$pconfig['ipaddr'] = "";
|
184
|
break;
|
185
|
case "pppoe":
|
186
|
$pconfig['type'] = "pppoe";
|
187
|
break;
|
188
|
case "pptp":
|
189
|
$pconfig['type'] = "pptp";
|
190
|
break;
|
191
|
default:
|
192
|
if(is_ipaddr($wancfg['ipaddr'])) {
|
193
|
$pconfig['type'] = "static";
|
194
|
$pconfig['ipaddr'] = $wancfg['ipaddr'];
|
195
|
$pconfig['subnet'] = $wancfg['subnet'];
|
196
|
$pconfig['gateway'] = $wancfg['gateway'];
|
197
|
$pconfig['pointtopoint'] = $wancfg['pointtopoint'];
|
198
|
} else {
|
199
|
$pconfig['type'] = "none";
|
200
|
}
|
201
|
break;
|
202
|
}
|
203
|
|
204
|
// Handle PPP type interfaces
|
205
|
if($wancfg['serialport'])
|
206
|
$pconfig['type'] = "none";
|
207
|
|
208
|
$pconfig['blockpriv'] = isset($wancfg['blockpriv']);
|
209
|
$pconfig['blockbogons'] = isset($wancfg['blockbogons']);
|
210
|
$pconfig['spoofmac'] = $wancfg['spoofmac'];
|
211
|
$pconfig['mtu'] = $wancfg['mtu'];
|
212
|
|
213
|
/* Wireless interface? */
|
214
|
if (isset($wancfg['wireless'])) {
|
215
|
/* Get wireless modes */
|
216
|
$wlanif = get_real_interface($if);
|
217
|
if (!does_interface_exist($wlanif))
|
218
|
interface_wireless_clone($wlanif, $wancfg);
|
219
|
$wlanbaseif = interface_get_wireless_base($wancfg['if']);
|
220
|
$wl_modes = get_wireless_modes($if);
|
221
|
$pconfig['standard'] = $wancfg['wireless']['standard'];
|
222
|
$pconfig['mode'] = $wancfg['wireless']['mode'];
|
223
|
$pconfig['protmode'] = $wancfg['wireless']['protmode'];
|
224
|
$pconfig['ssid'] = $wancfg['wireless']['ssid'];
|
225
|
$pconfig['channel'] = $wancfg['wireless']['channel'];
|
226
|
$pconfig['txpower'] = $wancfg['wireless']['txpower'];
|
227
|
$pconfig['distance'] = $wancfg['wireless']['distance'];
|
228
|
$pconfig['wme_enable'] = isset($wancfg['wireless']['wme']['enable']);
|
229
|
if (isset($wancfg['wireless']['puren']['enable']))
|
230
|
$pconfig['puremode'] = '11n';
|
231
|
else if (isset($wancfg['wireless']['pureg']['enable']))
|
232
|
$pconfig['puremode'] = '11g';
|
233
|
else
|
234
|
$pconfig['puremode'] = 'any';
|
235
|
$pconfig['apbridge_enable'] = isset($wancfg['wireless']['apbridge']['enable']);
|
236
|
$pconfig['authmode'] = $wancfg['wireless']['authmode'];
|
237
|
$pconfig['hidessid_enable'] = isset($wancfg['wireless']['hidessid']['enable']);
|
238
|
$pconfig['auth_server_addr'] = $wancfg['wireless']['auth_server_addr'];
|
239
|
$pconfig['auth_server_port'] = $wancfg['wireless']['auth_server_port'];
|
240
|
$pconfig['auth_server_shared_secret'] = $wancfg['wireless']['auth_server_shared_secret'];
|
241
|
if (is_array($wancfg['wireless']['wpa'])) {
|
242
|
$pconfig['debug_mode'] = $wancfg['wireless']['wpa']['debug_mode'];
|
243
|
$pconfig['macaddr_acl'] = $wancfg['wireless']['wpa']['macaddr_acl'];
|
244
|
$pconfig['mac_acl_enable'] = isset($wancfg['wireless']['wpa']['mac_acl_enable']);
|
245
|
$pconfig['auth_algs'] = $wancfg['wireless']['wpa']['auth_algs'];
|
246
|
$pconfig['wpa_mode'] = $wancfg['wireless']['wpa']['wpa_mode'];
|
247
|
$pconfig['wpa_key_mgmt'] = $wancfg['wireless']['wpa']['wpa_key_mgmt'];
|
248
|
$pconfig['wpa_pairwise'] = $wancfg['wireless']['wpa']['wpa_pairwise'];
|
249
|
$pconfig['wpa_group_rekey'] = $wancfg['wireless']['wpa']['wpa_group_rekey'];
|
250
|
$pconfig['wpa_gmk_rekey'] = $wancfg['wireless']['wpa']['wpa_gmk_rekey'];
|
251
|
$pconfig['wpa_strict_rekey'] = isset($wancfg['wireless']['wpa']['wpa_strict_rekey']);
|
252
|
$pconfig['passphrase'] = $wancfg['wireless']['wpa']['passphrase'];
|
253
|
$pconfig['ieee8021x'] = isset($wancfg['wireless']['wpa']['ieee8021x']['enable']);
|
254
|
$pconfig['ext_wpa_sw'] = $wancfg['wireless']['wpa']['ext_wpa_sw'];
|
255
|
$pconfig['wpa_enable'] = isset($wancfg['wireless']['wpa']['enable']);
|
256
|
}
|
257
|
$pconfig['wep_enable'] = isset($wancfg['wireless']['wep']['enable']);
|
258
|
$pconfig['mac_acl'] = $wancfg['wireless']['mac_acl'];
|
259
|
if (is_array($wancfg['wireless']['wep']) && is_array($wancfg['wireless']['wep']['key'])) {
|
260
|
$i = 1;
|
261
|
foreach ($wancfg['wireless']['wep']['key'] as $wepkey) {
|
262
|
$pconfig['key' . $i] = $wepkey['value'];
|
263
|
if (isset($wepkey['txkey']))
|
264
|
$pconfig['txkey'] = $i;
|
265
|
$i++;
|
266
|
}
|
267
|
if (!isset($wepkey['txkey']))
|
268
|
$pconfig['txkey'] = 1;
|
269
|
}
|
270
|
}
|
271
|
|
272
|
if ($_POST['apply']) {
|
273
|
unset($input_errors);
|
274
|
if (!is_subsystem_dirty('interfaces'))
|
275
|
$intput_errors[] = "You have already applied your settings!";
|
276
|
else {
|
277
|
unlink_if_exists("{$g['tmp_path']}/config.cache");
|
278
|
clear_subsystem_dirty('interfaces');
|
279
|
if ($pconfig['enable'])
|
280
|
interface_configure($if, true);
|
281
|
else
|
282
|
interface_bring_down($if);
|
283
|
|
284
|
/* restart snmp so that it binds to correct address */
|
285
|
services_snmpd_configure();
|
286
|
if ($if == "lan")
|
287
|
$savemsg = "The changes have been applied. You may need to correct your web browser's IP address.";
|
288
|
|
289
|
/* sync filter configuration */
|
290
|
setup_gateways_monitor();
|
291
|
|
292
|
clear_subsystem_dirty('staticroutes');
|
293
|
|
294
|
filter_configure();
|
295
|
|
296
|
enable_rrd_graphing();
|
297
|
}
|
298
|
header("Location: interfaces.php?if={$if}");
|
299
|
exit;
|
300
|
} else
|
301
|
|
302
|
if ($_POST && $_POST['enable'] != "yes") {
|
303
|
unset($wancfg['enable']);
|
304
|
if (isset($wancfg['wireless'])) {
|
305
|
interface_sync_wireless_clones($wancfg, false);
|
306
|
}
|
307
|
write_config("Interface {$_POST['descr']}({$if}) is now disabled.");
|
308
|
mark_subsystem_dirty('interfaces');
|
309
|
header("Location: interfaces.php?if={$if}");
|
310
|
exit;
|
311
|
} else
|
312
|
|
313
|
if ($_POST) {
|
314
|
unset($input_errors);
|
315
|
$pconfig = $_POST;
|
316
|
conf_mount_rw();
|
317
|
/* filter out spaces from descriptions */
|
318
|
$_POST['descr'] = remove_bad_chars($_POST['descr']);
|
319
|
/* okay first of all, cause we are just hiding the PPPoE HTML
|
320
|
* fields releated to PPPoE resets, we are going to unset $_POST
|
321
|
* vars, if the reset feature should not be used. Otherwise the
|
322
|
* data validation procedure below, may trigger a false error
|
323
|
* message.
|
324
|
*/
|
325
|
if (empty($_POST['pppoe_preset'])) {
|
326
|
unset($_POST['pppoe_pr_type']);
|
327
|
unset($_POST['pppoe_resethour']);
|
328
|
unset($_POST['pppoe_resetminute']);
|
329
|
unset($_POST['pppoe_resetdate']);
|
330
|
unset($_POST['pppoe_pr_preset_val']);
|
331
|
}
|
332
|
/* optional interface if list */
|
333
|
$iflist = get_configured_interface_with_descr();
|
334
|
/* description unique? */
|
335
|
foreach ($iflist as $ifent => $ifdescr) {
|
336
|
if ($if != $ifent && $ifdescr == $_POST['descr'])
|
337
|
$input_errors[] = "An interface with the specified description already exists.";
|
338
|
}
|
339
|
/* input validation */
|
340
|
if (isset($config['dhcpd']) && isset($config['dhcpd'][$if]['enable']) && $_POST['type'] != "static")
|
341
|
$input_errors[] = "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.";
|
342
|
|
343
|
switch($_POST['type']) {
|
344
|
case "static":
|
345
|
$reqdfields = explode(" ", "ipaddr subnet gateway");
|
346
|
$reqdfieldsn = explode(",", "IP address,Subnet bit count,Gateway");
|
347
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
348
|
break;
|
349
|
case "PPPoE":
|
350
|
if ($_POST['pppoe_dialondemand']) {
|
351
|
$reqdfields = explode(" ", "pppoe_username pppoe_password pppoe_dialondemand pppoe_idletimeout");
|
352
|
$reqdfieldsn = explode(",", "PPPoE username,PPPoE password,Dial on demand,Idle timeout value");
|
353
|
} else {
|
354
|
$reqdfields = explode(" ", "pppoe_username pppoe_password");
|
355
|
$reqdfieldsn = explode(",", "PPPoE username,PPPoE password");
|
356
|
}
|
357
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
358
|
break;
|
359
|
case "PPTP":
|
360
|
if ($_POST['pptp_dialondemand']) {
|
361
|
$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote pptp_dialondemand pptp_idletimeout");
|
362
|
$reqdfieldsn = explode(",", "PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address,Dial on demand,Idle timeout value");
|
363
|
} else {
|
364
|
$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote");
|
365
|
$reqdfieldsn = explode(",", "PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address");
|
366
|
}
|
367
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
368
|
break;
|
369
|
}
|
370
|
|
371
|
/* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */
|
372
|
$_POST['spoofmac'] = strtolower(str_replace("-", ":", $_POST['spoofmac']));
|
373
|
if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr'])))
|
374
|
$input_errors[] = "A valid IP address must be specified.";
|
375
|
if (($_POST['subnet'] && !is_numeric($_POST['subnet'])))
|
376
|
$input_errors[] = "A valid subnet bit count must be specified.";
|
377
|
if (($_POST['alias-address'] && !is_ipaddr($_POST['alias-address'])))
|
378
|
$input_errors[] = "A valid alias IP address must be specified.";
|
379
|
if (($_POST['alias-subnet'] && !is_numeric($_POST['alias-subnet'])))
|
380
|
$input_errors[] = "A valid alias subnet bit count must be specified.";
|
381
|
if ($_POST['gateway'] != "none") {
|
382
|
$match = false;
|
383
|
foreach($a_gateways as $gateway) {
|
384
|
if(in_array($_POST['gateway'], $gateway)) {
|
385
|
$match = true;
|
386
|
}
|
387
|
}
|
388
|
if(!$match) {
|
389
|
$input_errors[] = "A valid gateway must be specified.";
|
390
|
}
|
391
|
}
|
392
|
if (($_POST['pointtopoint'] && !is_ipaddr($_POST['pointtopoint'])))
|
393
|
$input_errors[] = "A valid point-to-point IP address must be specified.";
|
394
|
if (($_POST['provider'] && !is_domain($_POST['provider'])))
|
395
|
$input_errors[] = "The service name contains invalid characters.";
|
396
|
if (($_POST['pppoe_idletimeout'] != "") && !is_numericint($_POST['pppoe_idletimeout']))
|
397
|
$input_errors[] = "The idle timeout value must be an integer.";
|
398
|
if ($_POST['pppoe_resethour'] <> "" && !is_numericint($_POST['pppoe_resethour']) &&
|
399
|
$_POST['pppoe_resethour'] >= 0 && $_POST['pppoe_resethour'] <=23)
|
400
|
$input_errors[] = gettext("A valid PPPoE reset hour must be specified (0-23).");
|
401
|
if ($_POST['pppoe_resetminute'] <> "" && !is_numericint($_POST['pppoe_resetminute']) &&
|
402
|
$_POST['pppoe_resetminute'] >= 0 && $_POST['pppoe_resetminute'] <=59)
|
403
|
$input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59).");
|
404
|
if ($_POST['pppoe_resetdate'] <> "" && !is_numeric(str_replace("/", "", $_POST['pppoe_resetdate'])))
|
405
|
$input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy).");
|
406
|
if (($_POST['pptp_local'] && !is_ipaddr($_POST['pptp_local'])))
|
407
|
$input_errors[] = "A valid PPTP local IP address must be specified.";
|
408
|
if (($_POST['pptp_subnet'] && !is_numeric($_POST['pptp_subnet'])))
|
409
|
$input_errors[] = "A valid PPTP subnet bit count must be specified.";
|
410
|
if (($_POST['pptp_remote'] && !is_ipaddr($_POST['pptp_remote'])))
|
411
|
$input_errors[] = "A valid PPTP remote IP address must be specified.";
|
412
|
if (($_POST['pptp_idletimeout'] != "") && !is_numericint($_POST['pptp_idletimeout']))
|
413
|
$input_errors[] = "The idle timeout value must be an integer.";
|
414
|
if (($_POST['spoofmac'] && !is_macaddr($_POST['spoofmac'])))
|
415
|
$input_errors[] = "A valid MAC address must be specified.";
|
416
|
if ($_POST['mtu'] && ($_POST['mtu'] < 576))
|
417
|
$input_errors[] = "The MTU must be greater than 576 bytes.";
|
418
|
/* Wireless interface? */
|
419
|
if (isset($wancfg['wireless'])) {
|
420
|
$reqdfields = explode(" ", "mode ssid");
|
421
|
$reqdfieldsn = explode(",", "Mode,SSID");
|
422
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
423
|
check_wireless_mode();
|
424
|
/* loop through keys and enforce size */
|
425
|
for ($i = 1; $i <= 4; $i++) {
|
426
|
if ($_POST['key' . $i]) {
|
427
|
/* 64 bit */
|
428
|
if (strlen($_POST['key' . $i]) == 5)
|
429
|
continue;
|
430
|
if (strlen($_POST['key' . $i]) == 10) {
|
431
|
/* hex key */
|
432
|
if (stristr($_POST['key' . $i], "0x") == false) {
|
433
|
$_POST['key' . $i] = "0x" . $_POST['key' . $i];
|
434
|
}
|
435
|
continue;
|
436
|
}
|
437
|
if (strlen($_POST['key' . $i]) == 12) {
|
438
|
/* hex key */
|
439
|
if(stristr($_POST['key' . $i], "0x") == false) {
|
440
|
$_POST['key' . $i] = "0x" . $_POST['key' . $i];
|
441
|
}
|
442
|
continue;
|
443
|
}
|
444
|
/* 128 bit */
|
445
|
if (strlen($_POST['key' . $i]) == 13)
|
446
|
continue;
|
447
|
if (strlen($_POST['key' . $i]) == 26) {
|
448
|
/* hex key */
|
449
|
if (stristr($_POST['key' . $i], "0x") == false)
|
450
|
$_POST['key' . $i] = "0x" . $_POST['key' . $i];
|
451
|
continue;
|
452
|
}
|
453
|
if(strlen($_POST['key' . $i]) == 28)
|
454
|
continue;
|
455
|
$input_errors[] = "Invalid WEP key size. Sizes should be 40 (64) bit keys or 104 (128) bit.";
|
456
|
break;
|
457
|
}
|
458
|
}
|
459
|
|
460
|
if ($_POST['passphrase']) {
|
461
|
$passlen = strlen($_POST['passphrase']);
|
462
|
if ($passlen < 8 || $passlen > 64)
|
463
|
$input_errors[] = "The length of the passphrase should be between 8 and 63 characters.";
|
464
|
}
|
465
|
}
|
466
|
if (!$input_errors) {
|
467
|
unset($wancfg['ipaddr']);
|
468
|
unset($wancfg['subnet']);
|
469
|
unset($wancfg['gateway']);
|
470
|
unset($wancfg['pointtopoint']);
|
471
|
unset($wancfg['dhcphostname']);
|
472
|
unset($wancfg['pppoe_username']);
|
473
|
unset($wancfg['pppoe_password']);
|
474
|
unset($wancfg['pptp_username']);
|
475
|
unset($wancfg['pptp_password']);
|
476
|
unset($wancfg['provider']);
|
477
|
unset($wancfg['ondemand']);
|
478
|
unset($wancfg['timeout']);
|
479
|
if ($wancfg['pppoe']['pppoe-reset-type'])
|
480
|
unset($wancfg['pppoe']['pppoe-reset-type']);
|
481
|
unset($wancfg['local']);
|
482
|
unset($wancfg['subnet']);
|
483
|
unset($wancfg['remote']);
|
484
|
|
485
|
$wancfg['descr'] = remove_bad_chars($_POST['descr']);
|
486
|
if ($if == "wan" || $if == "lan") {
|
487
|
$wancfg['enable'] = true;
|
488
|
} else {
|
489
|
$wancfg['enable'] = $_POST['enable'] == "yes" ? true : false;
|
490
|
}
|
491
|
|
492
|
/* for dynamic interfaces we tack a gateway item onto the array to prevent system
|
493
|
* log messages from appearing. They can also manually add these items */
|
494
|
/* 1st added gateway gets a default bit */
|
495
|
$gateway_item = array();
|
496
|
if(empty($a_gateways)) {
|
497
|
$gateway_item['defaultgw'] = "true";
|
498
|
} else {
|
499
|
/* check for duplicates */
|
500
|
$skip = false;
|
501
|
foreach($a_gateways as $item) {
|
502
|
if(($item['interface'] == "$if") && ($item['gateway'] == "dynamic")) {
|
503
|
$skip = true;
|
504
|
}
|
505
|
}
|
506
|
if($skip == false) {
|
507
|
$gateway_item['gateway'] = "dynamic";
|
508
|
$gateway_item['descr'] = "Interface {$if} dynamic gateway";
|
509
|
$gateway_item['name'] = "GW_" . strtoupper($if);
|
510
|
$gateway_item['interface'] = "{$if}";
|
511
|
} else {
|
512
|
unset($gateway_item);
|
513
|
}
|
514
|
}
|
515
|
|
516
|
switch($_POST['type']) {
|
517
|
case "static":
|
518
|
$wancfg['ipaddr'] = $_POST['ipaddr'];
|
519
|
$wancfg['subnet'] = $_POST['subnet'];
|
520
|
if ($_POST['gateway'] != "none") {
|
521
|
$wancfg['gateway'] = $_POST['gateway'];
|
522
|
}
|
523
|
if (isset($wancfg['ispointtopoint'])) {
|
524
|
$wancfg['pointtopoint'] = $_POST['pointtopoint'];
|
525
|
}
|
526
|
break;
|
527
|
case "dhcp":
|
528
|
$wancfg['ipaddr'] = "dhcp";
|
529
|
$wancfg['dhcphostname'] = $_POST['dhcphostname'];
|
530
|
$wancfg['alias-address'] = $_POST['alias-address'];
|
531
|
$wancfg['alias-subnet'] = $_POST['alias-subnet'];
|
532
|
if($gateway_item) {
|
533
|
$a_gateways[] = $gateway_item;
|
534
|
}
|
535
|
break;
|
536
|
case "carpdev-dhcp":
|
537
|
$wancfg['ipaddr'] = "carpdev-dhcp";
|
538
|
$wancfg['dhcphostname'] = $_POST['dhcphostname'];
|
539
|
$wancfg['alias-address'] = $_POST['alias-address'];
|
540
|
$wancfg['alias-subnet'] = $_POST['alias-subnet'];
|
541
|
if($gateway_item) {
|
542
|
$a_gateways[] = $gateway_item;
|
543
|
}
|
544
|
break;
|
545
|
case "pppoe":
|
546
|
$wancfg['ipaddr'] = "pppoe";
|
547
|
$wancfg['pppoe_username'] = $_POST['pppoe_username'];
|
548
|
$wancfg['pppoe_password'] = $_POST['pppoe_password'];
|
549
|
$wancfg['provider'] = $_POST['provider'];
|
550
|
$wancfg['ondemand'] = $_POST['pppoe_dialondemand'] ? true : false;
|
551
|
$wancfg['timeout'] = $_POST['pppoe_idletimeout'];
|
552
|
if($gateway_item) {
|
553
|
$a_gateways[] = $gateway_item;
|
554
|
}
|
555
|
break;
|
556
|
case "pptp":
|
557
|
$wancfg['ipaddr'] = "pptp";
|
558
|
$wancfg['pptp_username'] = $_POST['pptp_username'];
|
559
|
$wancfg['pptp_password'] = $_POST['pptp_password'];
|
560
|
$wancfg['local'] = $_POST['pptp_local'];
|
561
|
$wancfg['subnet'] = $_POST['pptp_subnet'];
|
562
|
$wancfg['remote'] = $_POST['pptp_remote'];
|
563
|
$wancfg['ondemand'] = $_POST['pptp_dialondemand'] ? true : false;
|
564
|
$wancfg['timeout'] = $_POST['pptp_idletimeout'];
|
565
|
if($gateway_item) {
|
566
|
$a_gateways[] = $gateway_item;
|
567
|
}
|
568
|
break;
|
569
|
}
|
570
|
handle_pppoe_reset();
|
571
|
/* reset cron items if necessary */
|
572
|
if (empty($_POST['pppoe_preset'])) {
|
573
|
/* test whether a cron item exists and unset() it if necessary */
|
574
|
$itemhash = getMPDCRONSettings();
|
575
|
$item = $itemhash['ITEM'];
|
576
|
if (isset($item))
|
577
|
unset($config['cron']['item'][$itemhash['ID']]);
|
578
|
}
|
579
|
if($_POST['blockpriv'] == "yes") {
|
580
|
$wancfg['blockpriv'] = true;
|
581
|
} else {
|
582
|
unset($wancfg['blockpriv']);
|
583
|
}
|
584
|
if($_POST['blockbogons'] == "yes") {
|
585
|
$wancfg['blockbogons'] = true;
|
586
|
} else {
|
587
|
unset($wancfg['blockbogons']);
|
588
|
}
|
589
|
$wancfg['spoofmac'] = $_POST['spoofmac'];
|
590
|
if (empty($_POST['mtu'])) {
|
591
|
unset($wancfg['mtu']);
|
592
|
} else {
|
593
|
$wancfg['mtu'] = $_POST['mtu'];
|
594
|
}
|
595
|
if (isset($wancfg['wireless'])) {
|
596
|
handle_wireless_post();
|
597
|
}
|
598
|
write_config();
|
599
|
mark_subsystem_dirty('interfaces');
|
600
|
/* regenerate cron settings/crontab file */
|
601
|
configure_cron();
|
602
|
conf_mount_ro();
|
603
|
header("Location: interfaces.php?if={$if}");
|
604
|
exit;
|
605
|
}
|
606
|
} // end if($_POST)
|
607
|
|
608
|
function handle_pppoe_reset() {
|
609
|
global $_POST, $config, $g, $wancfg, $if;
|
610
|
/* perform a periodic reset? */
|
611
|
if(!isset($_POST['pppoe_preset'])) {
|
612
|
setup_pppoe_reset_file($if, false);
|
613
|
return;
|
614
|
}
|
615
|
if (!is_array($config['cron']['item']))
|
616
|
$config['cron']['item'] = array();
|
617
|
$itemhash = getMPDCRONSettings();
|
618
|
$item = $itemhash['ITEM'];
|
619
|
if (empty($item))
|
620
|
$item = array();
|
621
|
if (isset($_POST['pppoe_pr_type']) && $_POST['pppoe_pr_type'] == "custom") {
|
622
|
$wancfg['pppoe']['pppoe-reset-type'] = "custom";
|
623
|
$pconfig['pppoe_pr_custom'] = true;
|
624
|
$item['minute'] = $_POST['pppoe_resetminute'];
|
625
|
$item['hour'] = $_POST['pppoe_resethour'];
|
626
|
if (isset($_POST['pppoe_resetdate']) && $_POST['pppoe_resetdate'] <> "" && strlen($_POST['pppoe_resetdate']) == 10) {
|
627
|
$date = explode("/", $_POST['pppoe_resetdate']);
|
628
|
$item['mday'] = $date[1];
|
629
|
$item['month'] = $date[0];
|
630
|
} else {
|
631
|
$item['mday'] = "*";
|
632
|
$item['month'] = "*";
|
633
|
}
|
634
|
$item['wday'] = "*";
|
635
|
$item['who'] = "root";
|
636
|
$item['command'] = CRON_PPPOE_CMD_FILE;
|
637
|
} else if (isset($_POST['pppoe_pr_type']) && $_POST['pppoe_pr_type'] = "preset") {
|
638
|
$wancfg['pppoe']['pppoe-reset-type'] = "preset";
|
639
|
$pconfig['pppoe_pr_preset'] = true;
|
640
|
switch ($_POST['pppoe_pr_preset_val']) {
|
641
|
case "monthly":
|
642
|
$item['minute'] = "0";
|
643
|
$item['hour'] = "0";
|
644
|
$item['mday'] = "1";
|
645
|
$item['month'] = "*";
|
646
|
$item['wday'] = "*";
|
647
|
$item['who'] = "root";
|
648
|
$item['command'] = CRON_PPPOE_CMD_FILE;
|
649
|
break;
|
650
|
case "weekly":
|
651
|
$item['minute'] = "0";
|
652
|
$item['hour'] = "0";
|
653
|
$item['mday'] = "*";
|
654
|
$item['month'] = "*";
|
655
|
$item['wday'] = "0";
|
656
|
$item['who'] = "root";
|
657
|
$item['command'] = CRON_PPPOE_CMD_FILE;
|
658
|
break;
|
659
|
case "daily":
|
660
|
$item['minute'] = "0";
|
661
|
$item['hour'] = "0";
|
662
|
$item['mday'] = "*";
|
663
|
$item['month'] = "*";
|
664
|
$item['wday'] = "*";
|
665
|
$item['who'] = "root";
|
666
|
$item['command'] = CRON_PPPOE_CMD_FILE;
|
667
|
break;
|
668
|
case "hourly":
|
669
|
$item['minute'] = "0";
|
670
|
$item['hour'] = "*";
|
671
|
$item['mday'] = "*";
|
672
|
$item['month'] = "*";
|
673
|
$item['wday'] = "*";
|
674
|
$item['who'] = "root";
|
675
|
$item['command'] = CRON_PPPOE_CMD_FILE;
|
676
|
break;
|
677
|
} // end switch
|
678
|
} // end if
|
679
|
if (isset($itemhash['ID']))
|
680
|
$config['cron']['item'][$itemhash['ID']] = $item;
|
681
|
else
|
682
|
$config['cron']['item'][] = $item;
|
683
|
/* finally install the pppoerestart file */
|
684
|
if (isset($_POST['pppoe_preset'])) {
|
685
|
setup_pppoe_reset_file($if, true);
|
686
|
$wancfg['pppoe_reset'] = true;
|
687
|
$wancfg['pppoe_preset'] = true;
|
688
|
sigkillbypid("{$g['varrun_path']}/cron.pid", "HUP");
|
689
|
} else {
|
690
|
unset($wancfg['pppoe_reset']);
|
691
|
unset($wancfg['pppoe_preset']);
|
692
|
setup_pppoe_reset_file($if, false);
|
693
|
}
|
694
|
}
|
695
|
|
696
|
function handle_wireless_post() {
|
697
|
global $_POST, $config, $g, $wancfg, $if;
|
698
|
if (!is_array($wancfg['wireless']))
|
699
|
$wancfg['wireless'] = array();
|
700
|
$wancfg['wireless']['standard'] = $_POST['standard'];
|
701
|
$wancfg['wireless']['mode'] = $_POST['mode'];
|
702
|
$wancfg['wireless']['protmode'] = $_POST['protmode'];
|
703
|
$wancfg['wireless']['ssid'] = $_POST['ssid'];
|
704
|
$wancfg['wireless']['channel'] = $_POST['channel'];
|
705
|
$wancfg['wireless']['authmode'] = $_POST['authmode'];
|
706
|
$wancfg['wireless']['txpower'] = $_POST['txpower'];
|
707
|
$wancfg['wireless']['distance'] = $_POST['distance'];
|
708
|
if (!is_array($wancfg['wireless']['wpa']))
|
709
|
$wancfg['wireless']['wpa'] = array();
|
710
|
$wancfg['wireless']['wpa']['macaddr_acl'] = $_POST['macaddr_acl'];
|
711
|
$wancfg['wireless']['wpa']['auth_algs'] = $_POST['auth_algs'];
|
712
|
$wancfg['wireless']['wpa']['wpa_mode'] = $_POST['wpa_mode'];
|
713
|
$wancfg['wireless']['wpa']['wpa_key_mgmt'] = $_POST['wpa_key_mgmt'];
|
714
|
$wancfg['wireless']['wpa']['wpa_pairwise'] = $_POST['wpa_pairwise'];
|
715
|
$wancfg['wireless']['wpa']['wpa_group_rekey'] = $_POST['wpa_group_rekey'];
|
716
|
$wancfg['wireless']['wpa']['wpa_gmk_rekey'] = $_POST['wpa_gmk_rekey'];
|
717
|
$wancfg['wireless']['wpa']['passphrase'] = $_POST['passphrase'];
|
718
|
$wancfg['wireless']['wpa']['ext_wpa_sw'] = $_POST['ext_wpa_sw'];
|
719
|
$wancfg['wireless']['auth_server_addr'] = $_POST['auth_server_addr'];
|
720
|
$wancfg['wireless']['auth_server_port'] = $_POST['auth_server_port'];
|
721
|
$wancfg['wireless']['auth_server_shared_secret'] = $_POST['auth_server_shared_secret'];
|
722
|
if ($_POST['hidessid_enable'] == "yes")
|
723
|
$wancfg['wireless']['hidessid']['enable'] = true;
|
724
|
else if (isset($wancfg['wireless']['hidessid']['enable']))
|
725
|
unset($wancfg['wireless']['hidessid']['enable']);
|
726
|
if ($_POST['mac_acl_enable'] == "yes")
|
727
|
$wancfg['wireless']['wpa']['mac_acl_enable'] = true;
|
728
|
else if (isset($wancfg['wireless']['wpa']['mac_acl_enable']))
|
729
|
unset($wancfg['wireless']['wpa']['mac_acl_enable']);
|
730
|
if ($_POST['ieee8021x'] == "yes")
|
731
|
$wancfg['wireless']['wpa']['ieee8021x']['enable'] = true;
|
732
|
else if (isset($wancfg['wireless']['wpa']['ieee8021x']['enable']))
|
733
|
unset($wancfg['wireless']['wpa']['ieee8021x']['enable']);
|
734
|
if ($_POST['wpa_strict_rekey'] == "yes")
|
735
|
$wancfg['wireless']['wpa']['wpa_strict_rekey'] = true;
|
736
|
else if (isset($wancfg['wireless']['wpa']['wpa_strict_rekey']))
|
737
|
unset($wancfg['wireless']['wpa']['wpa_strict_rekey']);
|
738
|
if ($_POST['debug_mode'] == "yes")
|
739
|
$wancfg['wireless']['wpa']['debug_mode'] = true;
|
740
|
else if (isset($wancfg['wireless']['wpa']['debug_mode']))
|
741
|
sunset($wancfg['wireless']['wpa']['debug_mode']);
|
742
|
if ($_POST['wpa_enable'] == "yes")
|
743
|
$wancfg['wireless']['wpa']['enable'] = $_POST['wpa_enable'] = true;
|
744
|
else if (isset($wancfg['wireless']['wpa']['enable']))
|
745
|
unset($wancfg['wireless']['wpa']['enable']);
|
746
|
if ($_POST['wep_enable'] == "yes") {
|
747
|
if (!is_array($wancfg['wireless']['wep']))
|
748
|
$wancfg['wireless']['wep'] = array();
|
749
|
$wancfg['wireless']['wep']['enable'] = $_POST['wep_enable'] = true;
|
750
|
} else if (isset($wancfg['wireless']['wep']))
|
751
|
unset($wancfg['wireless']['wep']);
|
752
|
if ($_POST['wme_enable'] == "yes") {
|
753
|
if (!is_array($wancfg['wireless']['wme']))
|
754
|
$wancfg['wireless']['wme'] = array();
|
755
|
$wancfg['wireless']['wme']['enable'] = $_POST['wme_enable'] = true;
|
756
|
} else if (isset($wancfg['wireless']['wme']['enable']))
|
757
|
unset($wancfg['wireless']['wme']['enable']);
|
758
|
if ($_POST['puremode'] == "11g") {
|
759
|
if (!is_array($wancfg['wireless']['pureg']))
|
760
|
$wancfg['wireless']['pureg'] = array();
|
761
|
$wancfg['wireless']['pureg']['enable'] = true;
|
762
|
} else if ($_POST['puremode'] == "11n") {
|
763
|
if (!is_array($wancfg['wireless']['puren']))
|
764
|
$wancfg['wireless']['puren'] = array();
|
765
|
$wancfg['wireless']['puren']['enable'] = true;
|
766
|
} else {
|
767
|
if (isset($wancfg['wireless']['pureg']))
|
768
|
unset($wancfg['wireless']['pureg']);
|
769
|
if (isset($wancfg['wireless']['puren']))
|
770
|
unset($wancfg['wireless']['puren']);
|
771
|
}
|
772
|
if ($_POST['apbridge_enable'] == "yes") {
|
773
|
if (!is_array($wancfg['wireless']['apbridge']))
|
774
|
$wancfg['wireless']['apbridge'] = array();
|
775
|
$wancfg['wireless']['apbridge']['enable'] = $_POST['apbridge_enable'] = true;
|
776
|
} else if (isset($wancfg['wireless']['apbridge']['enable']))
|
777
|
unset($wancfg['wireless']['apbridge']['enable']);
|
778
|
if ($_POST['standard'] == "11g Turbo" || $_POST['standard'] == "11a Turbo") {
|
779
|
if (!is_array($wancfg['wireless']['turbo']))
|
780
|
$wancfg['wireless']['turbo'] = array();
|
781
|
$wancfg['wireless']['turbo']['enable'] = true;
|
782
|
} else if (isset($wancfg['wireless']['turbo']['enable']))
|
783
|
unset($wancfg['wireless']['turbo']['enable']);
|
784
|
$wancfg['wireless']['wep']['key'] = array();
|
785
|
for ($i = 1; $i <= 4; $i++) {
|
786
|
if ($_POST['key' . $i]) {
|
787
|
$newkey = array();
|
788
|
$newkey['value'] = $_POST['key' . $i];
|
789
|
if ($_POST['txkey'] == $i)
|
790
|
$newkey['txkey'] = true;
|
791
|
$wancfg['wireless']['wep']['key'][] = $newkey;
|
792
|
}
|
793
|
}
|
794
|
interface_sync_wireless_clones($wancfg, true);
|
795
|
}
|
796
|
|
797
|
function check_wireless_mode() {
|
798
|
global $_POST, $config, $g, $wlan_modes, $wancfg, $if, $wlanif, $wlanbaseif, $old_wireless_mode, $input_errors;
|
799
|
|
800
|
if ($wancfg['wireless']['mode'] == $_POST['mode'])
|
801
|
return;
|
802
|
|
803
|
if (does_interface_exist(interface_get_wireless_clone($wlanbaseif)))
|
804
|
$clone_count = 1;
|
805
|
else
|
806
|
$clone_count = 0;
|
807
|
if (is_array($config['wireless']['clone'])) {
|
808
|
foreach ($config['wireless']['clone'] as $clone) {
|
809
|
if ($clone['if'] == $wlanbaseif)
|
810
|
$clone_count++;
|
811
|
}
|
812
|
}
|
813
|
if ($clone_count > 1) {
|
814
|
$old_wireless_mode = $wancfg['wireless']['mode'];
|
815
|
$wancfg['wireless']['mode'] = $_POST['mode'];
|
816
|
if (!interface_wireless_clone("{$wlanif}_", $wancfg)) {
|
817
|
$input_errors[] = "Unable to change mode to {$wlan_modes[$wancfg['wireless']['mode']]}. You may already have the maximum number of wireless clones supported in this mode.";
|
818
|
} else {
|
819
|
mwexec("/sbin/ifconfig {$wlanif}_ destroy");
|
820
|
}
|
821
|
$wancfg['wireless']['mode'] = $old_wireless_mode;
|
822
|
}
|
823
|
}
|
824
|
|
825
|
$pgtitle = array("Interfaces", $pconfig['descr']);
|
826
|
$closehead = false;
|
827
|
include("head.inc");
|
828
|
$types = array("none" => "None", "static" => "Static", "dhcp" => "DHCP", "pppoe" => "PPPoE", "pptp" => "PPTP" /* , "carpdev-dhcp" => "CarpDev"*/);
|
829
|
|
830
|
?>
|
831
|
|
832
|
<script type="text/javascript" src="/javascript/numericupdown/js/numericupdown.js"></script>
|
833
|
<link href="/javascript/numericupdown/css/numericupdown.css" rel="stylesheet" type="text/css" />
|
834
|
<script type="text/javascript" src="/javascript/datepicker/js/datepicker.js"></script>
|
835
|
<link href="/javascript/datepicker/css/datepicker.css" rel="stylesheet" type="text/css"/>
|
836
|
|
837
|
<script type="text/javascript">
|
838
|
function updateType(t){
|
839
|
switch(t) {
|
840
|
<?php
|
841
|
/* OK, so this is sick using php to generate javascript, but it needed to be done */
|
842
|
foreach ($types as $key => $val) {
|
843
|
echo "case \"{$key}\": {\n";
|
844
|
$t = $types;
|
845
|
foreach ($t as $k => $v) {
|
846
|
if ($k != $key) {
|
847
|
echo "$('{$k}').hide();\n";
|
848
|
}
|
849
|
}
|
850
|
echo "}\n";
|
851
|
}
|
852
|
?>
|
853
|
}
|
854
|
$(t).show();
|
855
|
}
|
856
|
|
857
|
function show_allcfg(obj) {
|
858
|
if (obj.checked)
|
859
|
$('allcfg').show();
|
860
|
else
|
861
|
$('allcfg').hide();
|
862
|
}
|
863
|
|
864
|
function show_periodic_reset(obj) {
|
865
|
if (obj.checked)
|
866
|
$('presetwrap').show();
|
867
|
else
|
868
|
$('presetwrap').hide();
|
869
|
}
|
870
|
|
871
|
function show_mon_config() {
|
872
|
document.getElementById("showmonbox").innerHTML='';
|
873
|
aodiv = document.getElementById('showmon');
|
874
|
aodiv.style.display = "block";
|
875
|
}
|
876
|
|
877
|
function openwindow(url) {
|
878
|
var oWin = window.open(url,"pfSensePop","width=620,height=400,top=150,left=150");
|
879
|
if (oWin==null || typeof(oWin)=="undefined")
|
880
|
return false;
|
881
|
else
|
882
|
return true;
|
883
|
}
|
884
|
</script>
|
885
|
</head>
|
886
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
887
|
<?php include("fbegin.inc"); ?>
|
888
|
<form action="interfaces.php" method="post" name="iform" id="iform">
|
889
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
890
|
<?php if (is_subsystem_dirty('interfaces')): ?><p>
|
891
|
<?php print_info_box_np(gettext("The {$wancfg['descr']} configuration has been changed.<p>You must apply the changes in order for them to take effect.<p>Don't forget to adjust the DHCP Server range if needed before applying."));?><br />
|
892
|
<?php endif; ?>
|
893
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
894
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
895
|
<tr>
|
896
|
<td id="mainarea">
|
897
|
<div class="tabcont">
|
898
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
899
|
<tr>
|
900
|
<td colspan="2" valign="top" class="listtopic">General configuration</td>
|
901
|
</tr>
|
902
|
<?php if ($if != "wan" && $if != "lan"): ?>
|
903
|
<tr>
|
904
|
<td width="22%" valign="top" class="vncell">Enable</td>
|
905
|
<td width="78%" class="vtable">
|
906
|
<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable'] == true) echo "checked"; ?> onClick="show_allcfg(this);">
|
907
|
<strong>Enable Interface</strong>
|
908
|
</td>
|
909
|
</tr>
|
910
|
<?php else: ?>
|
911
|
<input name="enable" type="hidden" value="yes">
|
912
|
<?php endif; ?>
|
913
|
</table>
|
914
|
<div style="display:none;" name="allcfg" id="allcfg">
|
915
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
916
|
<tr>
|
917
|
<td width="22%" valign="top" class="vncell">Description</td>
|
918
|
<td width="78%" class="vtable">
|
919
|
<input name="descr" type="text" class="formfld unknown" id="descr" size="30" value="<?=htmlspecialchars($pconfig['descr']);?>">
|
920
|
<br><span class="vexpl">Enter a description (name) for the interface here.</span>
|
921
|
</td>
|
922
|
</tr>
|
923
|
<?
|
924
|
if(!$wancfg['serialport']):
|
925
|
?>
|
926
|
<tr>
|
927
|
<td valign="middle" class="vncell"><strong>Type</strong></td>
|
928
|
<td class="vtable">
|
929
|
<select name="type" onChange="updateType(this.value);" class="formselect" id="type">
|
930
|
<?php
|
931
|
foreach ($types as $key => $opt) {
|
932
|
echo "<option onClick=\"updateType('{$key}');\"";
|
933
|
if ($key == $pconfig['type'])
|
934
|
echo " selected";
|
935
|
echo " value=\"{$key}\" >" . htmlspecialchars($opt);
|
936
|
echo "</option>";
|
937
|
}
|
938
|
?>
|
939
|
</select>
|
940
|
</td>
|
941
|
</tr>
|
942
|
<?php endif; ?>
|
943
|
<tr>
|
944
|
<td valign="top" class="vncell">MAC address</td>
|
945
|
<td class="vtable">
|
946
|
<input name="spoofmac" type="text" class="formfld unknown" id="spoofmac" size="30" value="<?=htmlspecialchars($pconfig['spoofmac']);?>">
|
947
|
<?php
|
948
|
$ip = getenv('REMOTE_ADDR');
|
949
|
$mac = `/usr/sbin/arp -an | grep {$ip} | cut -d" " -f4`;
|
950
|
$mac = str_replace("\n","",$mac);
|
951
|
if($mac):
|
952
|
?>
|
953
|
<a OnClick="document.forms[0].spoofmac.value='<?=$mac?>';" href="#">Insert my local MAC address</a>
|
954
|
<?php endif; ?>
|
955
|
<br>
|
956
|
This field can be used to modify ("spoof") the MAC
|
957
|
address of the WAN interface<br>
|
958
|
(may be required with some cable connections)<br>
|
959
|
Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx
|
960
|
or leave blank
|
961
|
</td>
|
962
|
</tr>
|
963
|
<tr>
|
964
|
<td valign="top" class="vncell">MTU</td>
|
965
|
<td class="vtable">
|
966
|
<input name="mtu" type="text" class="formfld unknown" id="mtu" size="8" value="<?=htmlspecialchars($pconfig['mtu']);?>">
|
967
|
<br>
|
968
|
If you enter a value in this field, then MSS clamping for
|
969
|
TCP connections to the value entered above minus 40 (TCP/IP
|
970
|
header size) will be in effect. If you leave this field blank,
|
971
|
an MTU of 1500 bytes will be assumed.
|
972
|
</td>
|
973
|
</tr>
|
974
|
<tr>
|
975
|
<td colspan="2" valign="top" height="16"></td>
|
976
|
</tr>
|
977
|
<tr style="display:none;" name="none" id="none">
|
978
|
</tr>
|
979
|
<tr style="display:none;" name="static" id="static">
|
980
|
<td colspan="2" style="padding:0px;">
|
981
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
982
|
<tr>
|
983
|
<td colspan="2" valign="top" class="listtopic">Static IP configuration</td>
|
984
|
</tr>
|
985
|
<tr>
|
986
|
<td width="22%" valign="top" class="vncellreq">IP address</td>
|
987
|
<td width="78%" class="vtable">
|
988
|
<input name="ipaddr" type="text" class="formfld unknown" id="ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>">
|
989
|
/
|
990
|
<select name="subnet" class="formselect" id="subnet">
|
991
|
<?php
|
992
|
for ($i = 32; $i > 0; $i--) {
|
993
|
if($i <> 31) {
|
994
|
echo "<option value=\"{$i}\" ";
|
995
|
if ($i == $pconfig['subnet']) echo "selected";
|
996
|
echo ">" . $i . "</option>";
|
997
|
}
|
998
|
}
|
999
|
?>
|
1000
|
</select>
|
1001
|
</td>
|
1002
|
</tr>
|
1003
|
<?php if (isset($wancfg['ispointtopoint'])): ?>
|
1004
|
<tr>
|
1005
|
<td width="22%" valign="top" class="vncellreq">Point-to-point IP address </td>
|
1006
|
<td width"78%" class="vtable">
|
1007
|
<input name="pointtopoint" type="text" class="formfld unknown" id="pointtopoint" size="20" value="<?=htmlspecialchars($pconfig['pointtopoint']);?>">
|
1008
|
</td>
|
1009
|
</tr>
|
1010
|
<?php endif; ?>
|
1011
|
<tr>
|
1012
|
<td width="22%" valign="top" class="vncellreq">Gateway</td>
|
1013
|
<td width="78%" class="vtable">
|
1014
|
<select name="gateway" class="formselect" id="gateway">
|
1015
|
<option value="none" selected>None</option>
|
1016
|
<?php
|
1017
|
if(count($a_gateways) > 0) {
|
1018
|
foreach ($a_gateways as $gateway) {
|
1019
|
if($gateway['interface'] == $if) {
|
1020
|
?>
|
1021
|
<option value="<?=$gateway['name'];?>" <?php if ($gateway['name'] == $pconfig['gateway']) echo "selected"; ?>>
|
1022
|
<?=htmlspecialchars($gateway['name']);?>
|
1023
|
</option>
|
1024
|
<?php
|
1025
|
}
|
1026
|
}
|
1027
|
}
|
1028
|
?>
|
1029
|
</select>
|
1030
|
<br/>
|
1031
|
<div id='addgwbox'>
|
1032
|
If this interface is an Internet connection, select an existing Gateway from the list or <a OnClick="show_add_gateway();" href="#">add a new one</a>.
|
1033
|
</div>
|
1034
|
<div id='notebox'>
|
1035
|
</div>
|
1036
|
<div id="status">
|
1037
|
</div>
|
1038
|
<div style="display:none" id="addgateway" name="addgateway">
|
1039
|
<p>
|
1040
|
<table border="1" style="background:#990000; border-style: none none none none; width:225px;"><tr><td>
|
1041
|
<table bgcolor="#990000" cellpadding="1" cellspacing="1">
|
1042
|
<tr><td> </td>
|
1043
|
<tr>
|
1044
|
<td colspan="2"><center><b><font color="white">Add new gateway:</b></center></td>
|
1045
|
</tr>
|
1046
|
<tr><td> </td>
|
1047
|
<?php
|
1048
|
if($if == "wan" || $if == "WAN")
|
1049
|
$checked = " CHECKED";
|
1050
|
?>
|
1051
|
<tr>
|
1052
|
<td width="45%" align="right"><font color="white">Default gateway:</td><td><input type="checkbox" id="defaultgw" name="defaultgw"<?=$checked?>></td>
|
1053
|
</tr>
|
1054
|
<tr>
|
1055
|
<td align="right"><font color="white">Gateway Name:</td><td><input id="name" name="name" value="<?=$wancfg['descr'] . "GW"?>"></td>
|
1056
|
</tr>
|
1057
|
<tr>
|
1058
|
<td align="right"><font color="white">Gateway IP:</td><td><input id="gatewayip" name="gatewayip"></td>
|
1059
|
</tr>
|
1060
|
<tr>
|
1061
|
<td align="right"><font color="white">Description:</td><td><input id="gatewaydescr" name="gatewaydescr"></td>
|
1062
|
</tr>
|
1063
|
<tr><td> </td>
|
1064
|
<tr>
|
1065
|
<td colspan="2">
|
1066
|
<center>
|
1067
|
<div id='savebuttondiv'>
|
1068
|
<input type="hidden" name="addrtype" id="addrtype" value="IPv4" />
|
1069
|
<input id="gwsave" type="Button" value="Save Gateway" onClick='hide_add_gatewaysave();'>
|
1070
|
<input id="gwcancel" type="Button" value="Cancel" onClick='hide_add_gateway();'>
|
1071
|
</div>
|
1072
|
</center>
|
1073
|
</td>
|
1074
|
</tr>
|
1075
|
<tr><td> </td>
|
1076
|
</table>
|
1077
|
</td></tr></table>
|
1078
|
<p/>
|
1079
|
</div>
|
1080
|
</td>
|
1081
|
</tr>
|
1082
|
</table>
|
1083
|
</td>
|
1084
|
</tr>
|
1085
|
<tr style="display:none;" name="dhcp" id="dhcp">
|
1086
|
<td colspan="2" style="padding: 0px;">
|
1087
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
1088
|
<tr>
|
1089
|
<td colspan="2" valign="top" class="listtopic">DHCP client configuration</td>
|
1090
|
</tr>
|
1091
|
<tr>
|
1092
|
<td width="22%" valign="top" class="vncell">Hostname</td>
|
1093
|
<td width="78%" class="vtable">
|
1094
|
<input name="dhcphostname" type="text" class="formfld unknown" id="dhcphostname" size="40" value="<?=htmlspecialchars($pconfig['dhcphostname']);?>">
|
1095
|
<br>
|
1096
|
The value in this field is sent as the DHCP client identifier
|
1097
|
and hostname when requesting a DHCP lease. Some ISPs may require
|
1098
|
this (for client identification).
|
1099
|
</td>
|
1100
|
</tr>
|
1101
|
<tr>
|
1102
|
<td width="22%" valign="top" class="vncell">Alias IP address</td>
|
1103
|
<td width="78%" class="vtable">
|
1104
|
<input name="alias-address" type="text" class="formfld unknown" id="alias-address" size="20" value="<?=htmlspecialchars($pconfig['alias-address']);?>">
|
1105
|
<select name="alias-subnet" class="formselect" id="alias-subnet">
|
1106
|
<?php
|
1107
|
for ($i = 32; $i > 0; $i--) {
|
1108
|
if($i <> 31) {
|
1109
|
echo "<option value=\"{$i}\" ";
|
1110
|
if ($i == $pconfig['alias-subnet']) echo "selected";
|
1111
|
echo ">" . $i . "</option>";
|
1112
|
}
|
1113
|
}
|
1114
|
?>
|
1115
|
</select>
|
1116
|
The value in this field is used as a fixed alias IP address by the
|
1117
|
DHCP client.
|
1118
|
</td>
|
1119
|
</tr>
|
1120
|
</table>
|
1121
|
</td>
|
1122
|
</tr>
|
1123
|
<tr style="display:none;" name="pppoe" id="pppoe">
|
1124
|
<td colspan="2" style="padding:0px;">
|
1125
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
1126
|
<tr>
|
1127
|
<td colspan="2" valign="top" class="listtopic">PPPoE configuration</td>
|
1128
|
</tr>
|
1129
|
<tr>
|
1130
|
<td width="22%" valign="top" class="vncellreq">Username</td>
|
1131
|
<td width="78%" class="vtable">
|
1132
|
<input name="pppoe_username" type="text" class="formfld user" id="pppoe_username" size="20" value="<?=htmlspecialchars($pconfig['pppoe_username']);?>">
|
1133
|
</td>
|
1134
|
</tr>
|
1135
|
<tr>
|
1136
|
<td width="22%" valign="top" class="vncellreq">Password</td>
|
1137
|
<td width="78%" class="vtable">
|
1138
|
<input name="pppoe_password" type="password" class="formfld pwd" id="pppoe_password" size="20" value="<?=htmlspecialchars($pconfig['pppoe_password']);?>">
|
1139
|
</td>
|
1140
|
</tr>
|
1141
|
<tr>
|
1142
|
<td width="22%" valign="top" class="vncell">Service name</td>
|
1143
|
<td width="78%" class="vtable"><input name="provider" type="text" class="formfld unknown" id="provider" size="20" value="<?=htmlspecialchars($pconfig['provider']);?>">
|
1144
|
<br> <span class="vexpl">Hint: this field can usually be left empty</span>
|
1145
|
</td>
|
1146
|
</tr>
|
1147
|
<tr>
|
1148
|
<td width="22%" valign="top" class="vncell">Dial on demand</td>
|
1149
|
<td width="78%" class="vtable">
|
1150
|
<input name="pppoe_dialondemand" type="checkbox" id="pppoe_dialondemand" value="enable" <?php if ($pconfig['pppoe_dialondemand']) echo "checked"; ?>>
|
1151
|
<strong>Enable Dial-On-Demand mode</strong><br>
|
1152
|
This option causes the interface to operate in dial-on-demand mode, allowing you to have a <i>virtual full time</i> connection. The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected.
|
1153
|
</td>
|
1154
|
</tr>
|
1155
|
<tr>
|
1156
|
<td width="22%" valign="top" class="vncell">Idle timeout</td>
|
1157
|
<td width="78%" class="vtable">
|
1158
|
<input name="pppoe_idletimeout" type="text" class="formfld unknown" id="pppoe_idletimeout" size="8" value="<?=htmlspecialchars($pconfig['pppoe_idletimeout']);?>"> seconds<br>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.
|
1159
|
</td>
|
1160
|
</tr>
|
1161
|
<tr>
|
1162
|
<td width="22%" valign="top" class="vncell"><?=gettext("Periodic reset");?></td>
|
1163
|
<td width="78%" class="vtable">
|
1164
|
<input name="pppoe_preset" type="checkbox" id="pppoe_preset" value="yes" <?php if ($pconfig['pppoe_preset']) echo "checked=\"checked\""; ?> onclick="show_periodic_reset(this);" />
|
1165
|
<?= gettext("enable periodic PPPoE resets"); ?>
|
1166
|
<br />
|
1167
|
<?php if ($pconfig['pppoe_preset']): ?>
|
1168
|
<table id="presetwrap" cellspacing="0" cellpadding="0" width="100%">
|
1169
|
<?php else: ?>
|
1170
|
<table id="presetwrap" cellspacing="0" cellpadding="0" width="100%" style="display: none;">
|
1171
|
<?php endif; ?>
|
1172
|
<tr>
|
1173
|
<td align="left" valign="top">
|
1174
|
<p style="margin: 4px; padding: 4px 0 4px 0; width: 94%;">
|
1175
|
<input name="pppoe_pr_type" type="radio" id="pppoe_pr_custom" value="custom" <?php if ($pconfig['pppoe_pr_custom']) echo "checked=\"checked\""; ?> onclick="if (this.checked) { Effect.Appear('pppoecustomwrap', { duration: 0.0 }); Effect.Fade('pppoepresetwrap', { duration: 0.0 }); }" />
|
1176
|
<?= gettext("provide a custom reset time"); ?>
|
1177
|
<br />
|
1178
|
<input name="pppoe_pr_type" type="radio" id="pppoe_pr_preset" value="preset" <?php if ($pconfig['pppoe_pr_preset']) echo "checked=\"checked\""; ?> onclick="if (this.checked) { Effect.Appear('pppoepresetwrap', { duration: 0.0 }); Effect.Fade('pppoecustomwrap', { duration: 0.0 }); }" />
|
1179
|
<?= gettext("select reset time from a preset"); ?>
|
1180
|
</p>
|
1181
|
<?php if ($pconfig['pppoe_pr_custom']): ?>
|
1182
|
<p style="margin: 2px; padding: 4px; width: 94%;" id="pppoecustomwrap">
|
1183
|
<?php else: ?>
|
1184
|
<p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoecustomwrap">
|
1185
|
<?php endif; ?>
|
1186
|
<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" />
|
1187
|
<?= gettext("hour (0-23)"); ?><br />
|
1188
|
<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" />
|
1189
|
<?= gettext("minute (0-59)"); ?><br />
|
1190
|
<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']);?>" />
|
1191
|
<?= gettext("reset at a specific date (mm/dd/yyyy)"); ?>
|
1192
|
<br /> <br />
|
1193
|
<span class="red"><strong>Note: </strong></span>
|
1194
|
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.
|
1195
|
</p>
|
1196
|
<?php if ($pconfig['pppoe_pr_preset']): ?>
|
1197
|
<p style="margin: 2px; padding: 4px; width: 94%;" id="pppoepresetwrap">
|
1198
|
<?php else: ?>
|
1199
|
<p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoepresetwrap">
|
1200
|
<?php endif; ?>
|
1201
|
<input name="pppoe_pr_preset_val" type="radio" id="pppoe_monthly" value="monthly" <?php if ($pconfig['pppoe_monthly']) echo "checked=\"checked\""; ?> />
|
1202
|
<?= gettext("reset at each month ('0 0 1 * *')"); ?>
|
1203
|
<br />
|
1204
|
<input name="pppoe_pr_preset_val" type="radio" id="pppoe_weekly" value="weekly" <?php if ($pconfig['pppoe_weekly']) echo "checked=\"checked\""; ?> />
|
1205
|
<?= gettext("reset at each week ('0 0 * * 0')"); ?>
|
1206
|
<br />
|
1207
|
<input name="pppoe_pr_preset_val" type="radio" id="pppoe_daily" value="daily" <?php if ($pconfig['pppoe_daily']) echo "checked=\"checked\""; ?> />
|
1208
|
<?= gettext("reset at each day ('0 0 * * *')"); ?>
|
1209
|
<br />
|
1210
|
<input name="pppoe_pr_preset_val" type="radio" id="pppoe_hourly" value="hourly" <?php if ($pconfig['pppoe_hourly']) echo "checked=\"checked\""; ?> />
|
1211
|
<?= gettext("reset at each hour ('0 * * * *')"); ?>
|
1212
|
</p>
|
1213
|
</td>
|
1214
|
</tr>
|
1215
|
</table>
|
1216
|
</td>
|
1217
|
</tr>
|
1218
|
</table>
|
1219
|
</td>
|
1220
|
</tr>
|
1221
|
<tr style="display:none;" name="pptp" id="pptp">
|
1222
|
<td colspan="2" style="padding:0px;">
|
1223
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
1224
|
<tr>
|
1225
|
<td colspan="2" valign="top" class="listtopic">PPTP configuration</td>
|
1226
|
</tr>
|
1227
|
<tr>
|
1228
|
<td width="22%" valign="top" class="vncellreq">Username</td>
|
1229
|
<td width="78%" class="vtable">
|
1230
|
<input name="pptp_username" type="text" class="formfld user" id="pptp_username" size="20" value="<?=htmlspecialchars($pconfig['pptp_username']);?>">
|
1231
|
</td>
|
1232
|
</tr>
|
1233
|
<tr>
|
1234
|
<td width="22%" valign="top" class="vncellreq">Password</td>
|
1235
|
<td width="78%" class="vtable">
|
1236
|
<input name="pptp_password" type="text" class="formfld pwd" id="pptp_password" size="20" value="<?=htmlspecialchars($pconfig['pptp_password']);?>">
|
1237
|
</td>
|
1238
|
</tr>
|
1239
|
<tr>
|
1240
|
<td width="22%" width="100" valign="top" class="vncellreq">Local IP address</td>
|
1241
|
<td width="78%" class="vtable">
|
1242
|
<input name="pptp_local" type="text" class="formfld unknown" id="pptp_local" size="20" value="<?=htmlspecialchars($pconfig['pptp_local']);?>">
|
1243
|
/
|
1244
|
<select name="pptp_subnet" class="formselect" id="pptp_subnet">
|
1245
|
<?php for ($i = 31; $i > 0; $i--): ?>
|
1246
|
<option value="<?=$i;?>" <?php if ($i == $pconfig['pptp_subnet']) echo "selected"; ?>>
|
1247
|
<?=$i;?>
|
1248
|
</option>
|
1249
|
<?php endfor; ?>
|
1250
|
</select>
|
1251
|
</td>
|
1252
|
</tr>
|
1253
|
<tr>
|
1254
|
<td width="22%" width="100" valign="top" class="vncellreq">Remote IP address</td>
|
1255
|
<td width="78%" class="vtable">
|
1256
|
<input name="pptp_remote" type="text" class="formfld unknown" id="pptp_remote" size="20" value="<?=htmlspecialchars($pconfig['pptp_remote']);?>">
|
1257
|
</td>
|
1258
|
</tr>
|
1259
|
<tr>
|
1260
|
<td width="22%" valign="top" class="vncell">Dial on demand</td>
|
1261
|
<td width="78%" class="vtable">
|
1262
|
<input name="pptp_dialondemand" type="checkbox" id="pptp_dialondemand" value="enable" <?php if ($pconfig['pptp_dialondemand']) echo "checked"; ?>>
|
1263
|
<strong>Enable Dial-On-Demand mode</strong><br>
|
1264
|
This option causes the interface to operate in dial-on-demand mode, allowing you to have a <i>virtual full time</i> connection. The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected.
|
1265
|
</td>
|
1266
|
</tr>
|
1267
|
<tr>
|
1268
|
<td width="22%" valign="top" class="vncell">Idle timeout</td>
|
1269
|
<td width="78%" class="vtable">
|
1270
|
<input name="pptp_idletimeout" type="text" class="formfld unknown" id="pptp_idletimeout" size="8" value="<?=htmlspecialchars($pconfig['pptp_idletimeout']);?>"> seconds<br>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.
|
1271
|
</td>
|
1272
|
</tr>
|
1273
|
</table>
|
1274
|
</td>
|
1275
|
</tr>
|
1276
|
<?php
|
1277
|
/* Wireless interface? */
|
1278
|
if (isset($wancfg['wireless'])):
|
1279
|
?>
|
1280
|
<tr>
|
1281
|
<td colspan="2" valign="top" height="16"></td>
|
1282
|
</tr>
|
1283
|
<tr>
|
1284
|
<td colspan="2" valign="top" class="listtopic">Common wireless configuration - Settings apply to all wireless networks on <?=$wlanbaseif;?>.</td>
|
1285
|
</tr>
|
1286
|
<tr>
|
1287
|
<td valign="top" class="vncellreq">Standard</td>
|
1288
|
<td class="vtable">
|
1289
|
<select name="standard" class="formselect" id="standard">
|
1290
|
<?php
|
1291
|
foreach($wl_modes as $wl_standard => $wl_channels) {
|
1292
|
echo "<option ";
|
1293
|
if ($pconfig['standard'] == "$wl_standard")
|
1294
|
echo "selected ";
|
1295
|
echo "value=\"$wl_standard\">802.$wl_standard</option>\n";
|
1296
|
}
|
1297
|
?>
|
1298
|
</select>
|
1299
|
</td>
|
1300
|
</tr>
|
1301
|
<?php if (isset($wl_modes['11g'])): ?>
|
1302
|
<tr>
|
1303
|
<td valign="top" class="vncellreq">802.11g OFDM Protection Mode</td>
|
1304
|
<td class="vtable">
|
1305
|
<select name="protmode" class="formselect" id="protmode">
|
1306
|
<option <? if ($pconfig['protmode'] == 'off') echo "selected";?> value="off">Protection mode off</option>
|
1307
|
<option <? if ($pconfig['protmode'] == 'cts') echo "selected";?> value="cts">Protection mode CTS to self</option>
|
1308
|
<option <? if ($pconfig['protmode'] == 'rtscts') echo "selected";?> value="rtscts">Protection mode RTS and CTS</option>
|
1309
|
</select>
|
1310
|
<br/>
|
1311
|
For IEEE 802.11g, use the specified technique for protecting OFDM frames in a mixed 11b/11g network.
|
1312
|
<br/>
|
1313
|
</td>
|
1314
|
</tr>
|
1315
|
<?php else: ?>
|
1316
|
<input name="protmode" type="hidden" id="protmode" value="off">
|
1317
|
<?php endif; ?>
|
1318
|
<tr>
|
1319
|
<td valign="top" class="vncellreq">Transmit power</td>
|
1320
|
<td class="vtable">
|
1321
|
<select name="txpower" class="formselect" id="txpower">
|
1322
|
<?
|
1323
|
for($x = 99; $x > 0; $x--) {
|
1324
|
if($pconfig["txpower"] == $x)
|
1325
|
$SELECTED = " SELECTED";
|
1326
|
else
|
1327
|
$SELECTED = "";
|
1328
|
echo "<option {$SELECTED}>{$x}</option>\n";
|
1329
|
}
|
1330
|
?>
|
1331
|
</select><br/>
|
1332
|
Note: Typically only a few discreet power settings are available and the driver will use the setting closest to the specified value. Not all adaptors support changing the transmit power setting.
|
1333
|
</td>
|
1334
|
</tr>
|
1335
|
<tr>
|
1336
|
<td valign="top" class="vncellreq">Channel</td>
|
1337
|
<td class="vtable">
|
1338
|
<select name="channel" class="formselect" id="channel">
|
1339
|
<option <? if ($pconfig['channel'] == 0) echo "selected"; ?> value="0">Auto</option>
|
1340
|
<?php
|
1341
|
foreach($wl_modes as $wl_standard => $wl_channels) {
|
1342
|
if($wl_standard == "11g") { $wl_standard = "11b/g"; }
|
1343
|
else if($wl_standard == "11ng") { $wl_standard = "11b/g/n"; }
|
1344
|
else if($wl_standard == "11na") { $wl_standard = "11a/n"; }
|
1345
|
foreach($wl_channels as $wl_channel) {
|
1346
|
echo "<option ";
|
1347
|
if ($pconfig['channel'] == "$wl_channel") {
|
1348
|
echo "selected ";
|
1349
|
}
|
1350
|
echo "value=\"$wl_channel\">$wl_standard - $wl_channel</option>\n";
|
1351
|
}
|
1352
|
}
|
1353
|
?>
|
1354
|
</select>
|
1355
|
<br/>
|
1356
|
Note: Not all channels may be supported by your card. Auto may override the wireless standard selected above.
|
1357
|
</td>
|
1358
|
</tr>
|
1359
|
<tr>
|
1360
|
<td valign="top" class="vncell">Distance setting</td>
|
1361
|
<td class="vtable">
|
1362
|
<input name="distance" type="text" class="formfld unknown" id="distance" size="5" value="<?=htmlspecialchars($pconfig['distance']);?>">
|
1363
|
<br/>
|
1364
|
Note: This field can be used to tune ACK/CTS timers to fit the distance between AP and Client<br/>
|
1365
|
(measured in Meters and works only for Atheros based cards !)
|
1366
|
</td>
|
1367
|
</tr>
|
1368
|
<tr>
|
1369
|
<td colspan="2" valign="top" height="16"></td>
|
1370
|
</tr>
|
1371
|
<tr>
|
1372
|
<td colspan="2" valign="top" class="listtopic">Wireless configuration</td>
|
1373
|
</tr>
|
1374
|
<tr>
|
1375
|
<td valign="top" class="vncellreq">Mode</td>
|
1376
|
<td class="vtable">
|
1377
|
<select name="mode" class="formselect" id="mode">
|
1378
|
<option <? if ($pconfig['mode'] == 'bss') echo "selected";?> value="bss">Infrastructure (BSS)</option>
|
1379
|
<option <? if ($pconfig['mode'] == 'adhoc') echo "selected";?> value="adhoc">Ad-hoc (IBSS)</option>
|
1380
|
<option <? if ($pconfig['mode'] == 'hostap') echo "selected";?> value="hostap">Access Point</option>
|
1381
|
</select>
|
1382
|
</td>
|
1383
|
</tr>
|
1384
|
<tr>
|
1385
|
<td valign="top" class="vncellreq">SSID</td>
|
1386
|
<td class="vtable">
|
1387
|
<input name="ssid" type="text" class="formfld unknown" id="ssid" size="20" value="<?=htmlspecialchars($pconfig['ssid']); ?>">
|
1388
|
</td>
|
1389
|
</tr>
|
1390
|
<?php if (isset($wl_modes['11ng']) || isset($wl_modes['11na'])): ?>
|
1391
|
<tr>
|
1392
|
<td valign="top" class="vncell">Minimum wireless standard</td>
|
1393
|
<td class="vtable">
|
1394
|
<select name="puremode" class="formselect" id="puremode">
|
1395
|
<option <? if ($pconfig['puremode'] == 'any') echo "selected";?> value="any">Any</option>
|
1396
|
<?php if (isset($wl_modes['11g'])): ?>
|
1397
|
<option <? if ($pconfig['puremode'] == '11g') echo "selected";?> value="11g">802.11g</option>
|
1398
|
<?php endif; ?>
|
1399
|
<option <? if ($pconfig['puremode'] == '11n') echo "selected";?> value="11n">802.11n</option>
|
1400
|
</select>
|
1401
|
<br/>
|
1402
|
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).
|
1403
|
</td>
|
1404
|
</tr>
|
1405
|
<?php elseif (isset($wl_modes['11g'])): ?>
|
1406
|
<tr>
|
1407
|
<td valign="top" class="vncell">802.11g only</td>
|
1408
|
<td class="vtable">
|
1409
|
<input name="puremode" type="checkbox" value="11g" class="formfld" id="puremode" <? if ($pconfig['puremode'] == '11g') echo "checked";?>>
|
1410
|
<br/>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).
|
1411
|
</td>
|
1412
|
</tr>
|
1413
|
<?php endif; ?>
|
1414
|
<tr>
|
1415
|
<td valign="top" class="vncell">Allow intra-BSS communication</td>
|
1416
|
<td class="vtable">
|
1417
|
<input name="apbridge_enable" type="checkbox" value="yes" class="formfld" id="apbridge_enable" <? if ($pconfig['apbridge_enable']) echo "checked";?>>
|
1418
|
<br/>
|
1419
|
When operating as an access point, enable this if you want to pass packets between wireless clients directly.
|
1420
|
<br/>
|
1421
|
Disabling the internal bridging is useful when traffic is to be processed with packet filtering.
|
1422
|
</td>
|
1423
|
</tr>
|
1424
|
<tr>
|
1425
|
<td valign="top" class="vncell">Enable WME</td>
|
1426
|
<td class="vtable">
|
1427
|
<input name="wme_enable" type="checkbox" class="formfld" id="wme_enable" value="yes" <? if ($pconfig['wme_enable']) echo "checked";?>>
|
1428
|
<br/>Setting this option will force the card to use WME (wireless QoS).
|
1429
|
</td>
|
1430
|
</tr>
|
1431
|
<tr>
|
1432
|
<td valign="top" class="vncell">Enable Hide SSID</td>
|
1433
|
<td class="vtable">
|
1434
|
<input name="hidessid_enable" type="checkbox" class="formfld" id="hidessid_enable" value="yes" <? if ($pconfig['hidessid_enable']) echo "checked";?>>
|
1435
|
<br/>
|
1436
|
Setting this option will force the card to NOT broadcast its SSID
|
1437
|
<br/>
|
1438
|
(this might create problems for some clients). </td>
|
1439
|
</tr>
|
1440
|
<tr>
|
1441
|
<td valign="top" class="vncell">WEP</td>
|
1442
|
<td class="vtable">
|
1443
|
<input name="wep_enable" type="checkbox" id="wep_enable" value="yes" <? if ($pconfig['wep_enable']) echo "checked"; ?>>
|
1444
|
<strong>Enable WEP</strong>
|
1445
|
<table border="0" cellspacing="0" cellpadding="0">
|
1446
|
<tr>
|
1447
|
<td> </td>
|
1448
|
<td> </td>
|
1449
|
<td> TX key </td>
|
1450
|
</tr>
|
1451
|
<tr>
|
1452
|
<td>Key 1: </td>
|
1453
|
<td>
|
1454
|
<input name="key1" type="text" class="formfld unknown" id="key1" size="30" value="<?=htmlspecialchars($pconfig['key1']);?>">
|
1455
|
</td>
|
1456
|
<td align="center">
|
1457
|
<input name="txkey" type="radio" value="1" <? if ($pconfig['txkey'] == 1) echo "checked";?>>
|
1458
|
</td>
|
1459
|
</tr>
|
1460
|
<tr>
|
1461
|
<td>Key 2: </td>
|
1462
|
<td>
|
1463
|
<input name="key2" type="text" class="formfld unknown" id="key2" size="30" value="<?=htmlspecialchars($pconfig['key2']);?>">
|
1464
|
</td>
|
1465
|
<td align="center">
|
1466
|
<input name="txkey" type="radio" value="2" <? if ($pconfig['txkey'] == 2) echo "checked";?>>
|
1467
|
</td>
|
1468
|
</tr>
|
1469
|
<tr>
|
1470
|
<td>Key 3: </td>
|
1471
|
<td>
|
1472
|
<input name="key3" type="text" class="formfld unknown" id="key3" size="30" value="<?=htmlspecialchars($pconfig['key3']);?>">
|
1473
|
</td>
|
1474
|
<td align="center">
|
1475
|
<input name="txkey" type="radio" value="3" <? if ($pconfig['txkey'] == 3) echo "checked";?>>
|
1476
|
</td>
|
1477
|
</tr>
|
1478
|
<tr>
|
1479
|
<td>Key 4: </td>
|
1480
|
<td>
|
1481
|
<input name="key4" type="text" class="formfld unknown" id="key4" size="30" value="<?=htmlspecialchars($pconfig['key4']);?>">
|
1482
|
</td>
|
1483
|
<td align="center">
|
1484
|
<input name="txkey" type="radio" value="4" <? if ($pconfig['txkey'] == 4) echo "checked";?>>
|
1485
|
</td>
|
1486
|
</tr>
|
1487
|
</table>
|
1488
|
<br/>
|
1489
|
40 (64) bit keys may be entered as 5 ASCII characters or 10 hex digits preceded by '0x'.<br/>
|
1490
|
104 (128) bit keys may be entered as 13 ASCII characters or 26 hex digits preceded by '0x'.
|
1491
|
</td>
|
1492
|
</tr>
|
1493
|
<tr>
|
1494
|
<td valign="top" class="vncell">WPA</td>
|
1495
|
<td class="vtable">
|
1496
|
<input name="wpa_enable" type="checkbox" class="formfld" id="wpa_enable" value="yes" <? if ($pconfig['wpa_enable']) echo "checked"; ?>>
|
1497
|
<strong>Enable WPA</strong>
|
1498
|
<br/><br/>
|
1499
|
<table border="0" cellspacing="0" cellpadding="0">
|
1500
|
<tr>
|
1501
|
<td> </td>
|
1502
|
<td> WPA Pre Shared Key </td>
|
1503
|
</tr>
|
1504
|
<tr>
|
1505
|
<td>PSK: </td>
|
1506
|
<td>
|
1507
|
<input name="passphrase" type="text" class="formfld unknown" id="passphrase" size="66" value="<?=htmlspecialchars($pconfig['passphrase']);?>">
|
1508
|
</td>
|
1509
|
</tr>
|
1510
|
</table>
|
1511
|
<br/>Passphrase must be from 8 to 63 characters.
|
1512
|
</td>
|
1513
|
</tr>
|
1514
|
<tr>
|
1515
|
<td valign="top" class="vncell">WPA Mode</td>
|
1516
|
<td class="vtable">
|
1517
|
<select name="wpa_mode" class="formselect" id="wpa_mode">
|
1518
|
<option <? if ($pconfig['wpa_mode'] == '1') echo "selected";?> value="1">WPA</option>
|
1519
|
<option <? if ($pconfig['wpa_mode'] == '2') echo "selected";?> value="2">WPA2</option>
|
1520
|
<option <? if ($pconfig['wpa_mode'] == '3') echo "selected";?> value="3">Both</option>
|
1521
|
</select>
|
1522
|
</td>
|
1523
|
</tr>
|
1524
|
<tr>
|
1525
|
<td valign="top" class="vncell">WPA Key Management Mode</td>
|
1526
|
<td class="vtable">
|
1527
|
<select name="wpa_key_mgmt" class="formselect" id="wpa_key_mgmt">
|
1528
|
<option <? if ($pconfig['wpa_key_mgmt'] == 'WPA-PSK') echo "selected";?> value="WPA-PSK">Pre Shared Key</option>
|
1529
|
<option <? if ($pconfig['wpa_key_mgmt'] == 'WPA-EAP') echo "selected";?> value="WPA-EAP">Extensible Authentication Protocol</option>
|
1530
|
<option <? if ($pconfig['wpa_key_mgmt'] == 'WPA-PSK WPA-EAP') echo "selected";?> value="WPA-PSK WPA-EAP">Both</option>
|
1531
|
</select>
|
1532
|
</td>
|
1533
|
</tr>
|
1534
|
<tr>
|
1535
|
<td valign="top" class="vncell">Authentication</td>
|
1536
|
<td class="vtable">
|
1537
|
<select name="auth_algs" class="formselect" id="auth_algs">
|
1538
|
<option <? if ($pconfig['auth_algs'] == '1') echo "selected";?> value="1">Open System Authentication</option>
|
1539
|
<option <? if ($pconfig['auth_algs'] == '2') echo "selected";?> value="2">Shared Key Authentication</option>
|
1540
|
<option <? if ($pconfig['auth_algs'] == '3') echo "selected";?> value="3">Both</option>
|
1541
|
</select>
|
1542
|
<br/>Note: Shared Key Authentication requires WEP.</br>
|
1543
|
</td>
|
1544
|
</tr>
|
1545
|
<tr>
|
1546
|
<td valign="top" class="vncell">WPA Pairwise</td>
|
1547
|
<td class="vtable">
|
1548
|
<select name="wpa_pairwise" class="formselect" id="wpa_pairwise">
|
1549
|
<option <? if ($pconfig['wpa_pairwise'] == 'CCMP TKIP') echo "selected";?> value="CCMP TKIP">Both</option>
|
1550
|
<option <? if ($pconfig['wpa_pairwise'] == 'CCMP') echo "selected";?> value="CCMP">AES (recommended)</option>
|
1551
|
<option <? if ($pconfig['wpa_pairwise'] == 'TKIP') echo "selected";?> value="TKIP">TKIP</option>
|
1552
|
</select>
|
1553
|
</td>
|
1554
|
</tr>
|
1555
|
<tr>
|
1556
|
<td valign="top" class="vncell">Key Rotation</td>
|
1557
|
<td class="vtable">
|
1558
|
<input name="wpa_group_rekey" type="text" class="formfld unknown" id="wpa_group_rekey" size="30" value="<? echo $pconfig['wpa_group_rekey'] ? $pconfig['wpa_group_rekey'] : "60";?>">
|
1559
|
<br/>Allowed values are 1-9999 but should not be longer than Master Key Regeneration time.
|
1560
|
</td>
|
1561
|
</tr>
|
1562
|
<tr>
|
1563
|
<td valign="top" class="vncell">Master Key Regeneration</td>
|
1564
|
<td class="vtable">
|
1565
|
<input name="wpa_gmk_rekey" type="text" class="formfld" id="wpa_gmk_rekey" size="30" value="<? echo $pconfig['wpa_gmk_rekey'] ? $pconfig['wpa_gmk_rekey'] : "3600";?>">
|
1566
|
<br/>Allowed values are 1-9999 but should not be shorter than Key Rotation time.
|
1567
|
</td>
|
1568
|
</tr>
|
1569
|
<tr>
|
1570
|
<td valign="top" class="vncell">Strict Key Regeneration</td>
|
1571
|
<td class="vtable">
|
1572
|
<input name="wpa_strict_rekey" type="checkbox" value="yes" class="formfld" id="wpa_strict_rekey" <? if ($pconfig['wpa_strict_rekey']) echo "checked"; ?>>
|
1573
|
<br/>Setting this option will force the AP to rekey whenever a client disassociates.
|
1574
|
</td>
|
1575
|
</tr>
|
1576
|
<tr>
|
1577
|
<td valign="top" class="vncell">Enable IEEE802.1X Authentication</td>
|
1578
|
<td class="vtable">
|
1579
|
<input name="ieee8021x" type="checkbox" value="yes" class="formfld" id="ieee8021x" <? if ($pconfig['ieee8021x']) echo "checked";?>>
|
1580
|
<br/>Setting this option will enable 802.1x authentication.
|
1581
|
</td>
|
1582
|
</tr>
|
1583
|
<tr>
|
1584
|
<td valign="top" class="vncell">802.1X Authentication Server IP Address</td>
|
1585
|
<td class="vtable">
|
1586
|
<input name="auth_server_addr" id="auth_server_addr" type="text" class="formfld unknown" size="66" value="<?=htmlspecialchars($pconfig['auth_server_addr']);?>">
|
1587
|
<br/>Enter the IP address of the 802.1X Authentication Server. This is commonly a Radius server (FreeRadius, Internet Authentication Services, etc.)
|
1588
|
</td>
|
1589
|
</tr>
|
1590
|
<tr>
|
1591
|
<td valign="top" class="vncell">802.1X Authentication Server Port</td>
|
1592
|
<td class="vtable">
|
1593
|
<input name="auth_server_port" id="auth_server_port" type="text" class="formfld unknown" size="66" value="<?=htmlspecialchars($pconfig['auth_server_port']);?>">
|
1594
|
<br/>Leave blank for the default 1812 port.
|
1595
|
</td>
|
1596
|
</tr>
|
1597
|
<tr>
|
1598
|
<td valign="top" class="vncell">802.1X Authentication Server Shared Secret</td>
|
1599
|
<td class="vtable">
|
1600
|
<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']);?>">
|
1601
|
<br/>
|
1602
|
</td>
|
1603
|
</tr>
|
1604
|
<? endif; ?>
|
1605
|
<tr>
|
1606
|
<td colspan="2" valign="top" height="16"></td>
|
1607
|
</tr>
|
1608
|
<tr>
|
1609
|
<td colspan="2" valign="top" class="listtopic">Private networks</td>
|
1610
|
</tr>
|
1611
|
<tr>
|
1612
|
<td valign="middle" class="vncell"> </td>
|
1613
|
<td class="vtable">
|
1614
|
<a name="rfc1918"></a>
|
1615
|
<input name="blockpriv" type="checkbox" id="blockpriv" value="yes" <?php if ($pconfig['blockpriv']) echo "checked"; ?>>
|
1616
|
<strong>Block private networks</strong><br>
|
1617
|
When set, this option blocks traffic from IP addresses that are reserved
|
1618
|
for private networks as per RFC 1918 (10/8, 172.16/12, 192.168/16) as
|
1619
|
well as loopback addresses (127/8). You should generally
|
1620
|
leave this option turned on, unless your WAN network lies in such
|
1621
|
a private address space, too.
|
1622
|
</td>
|
1623
|
</tr>
|
1624
|
<tr>
|
1625
|
<td valign="middle" class="vncell"> </td>
|
1626
|
<td class="vtable">
|
1627
|
<input name="blockbogons" type="checkbox" id="blockbogons" value="yes" <?php if ($pconfig['blockbogons']) echo "checked"; ?>>
|
1628
|
<strong>Block bogon networks</strong><br>
|
1629
|
When set, this option blocks traffic from IP addresses that are reserved
|
1630
|
(but not RFC 1918) or not yet assigned by IANA.
|
1631
|
Bogons are prefixes that should never appear in the Internet routing table,
|
1632
|
and obviously should not appear as the source address in any packets you receive.
|
1633
|
</td>
|
1634
|
</tr>
|
1635
|
</tr>
|
1636
|
</table>
|
1637
|
</div>
|
1638
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
1639
|
<tr>
|
1640
|
<td width="100" valign="top">
|
1641
|
|
1642
|
</td>
|
1643
|
<td>
|
1644
|
<br/>
|
1645
|
<input id="save" name="Submit" type="submit" class="formbtn" value="Save">
|
1646
|
<input id="cancel" type="button" class="formbtn" value="Cancel" onclick="history.back()">
|
1647
|
<input name="if" type="hidden" id="if" value="<?=$if;?>">
|
1648
|
</td>
|
1649
|
</tr>
|
1650
|
</table>
|
1651
|
</td>
|
1652
|
</table>
|
1653
|
</div>
|
1654
|
</td></tr>
|
1655
|
</table>
|
1656
|
</form>
|
1657
|
<script type="text/javascript">
|
1658
|
var gatewayip;
|
1659
|
var name;
|
1660
|
function show_add_gateway() {
|
1661
|
document.getElementById("addgateway").style.display = '';
|
1662
|
document.getElementById("addgwbox").style.display = 'none';
|
1663
|
document.getElementById("gateway").style.display = 'none';
|
1664
|
document.getElementById("save").style.display = 'none';
|
1665
|
document.getElementById("cancel").style.display = 'none';
|
1666
|
document.getElementById("gwsave").style.display = '';
|
1667
|
document.getElementById("gwcancel").style.display = '';
|
1668
|
$('notebox').innerHTML="";
|
1669
|
}
|
1670
|
function hide_add_gateway() {
|
1671
|
document.getElementById("addgateway").style.display = 'none';
|
1672
|
document.getElementById("addgwbox").style.display = '';
|
1673
|
document.getElementById("gateway").style.display = '';
|
1674
|
document.getElementById("save").style.display = '';
|
1675
|
document.getElementById("cancel").style.display = '';
|
1676
|
document.getElementById("gwsave").style.display = '';
|
1677
|
document.getElementById("gwcancel").style.display = '';
|
1678
|
}
|
1679
|
function hide_add_gatewaysave() {
|
1680
|
document.getElementById("addgateway").style.display = 'none';
|
1681
|
$('status').innerHTML = '<img src="/themes/metallic/images/misc/loader.gif"> One moment please...';
|
1682
|
var iface = $F('if');
|
1683
|
name = $('name').getValue();
|
1684
|
var descr = $('gatewaydescr').getValue();
|
1685
|
gatewayip = $('gatewayip').getValue();
|
1686
|
addrtype = $('addrtype').getValue();
|
1687
|
var defaultgw = $('defaultgw').getValue();
|
1688
|
var url = "system_gateways_edit.php";
|
1689
|
var pars = 'isAjax=true&defaultgw=' + escape(defaultgw) + '&interface=' + escape(iface) + '&name=' + escape(name) + '&descr=' + escape(descr) + '&gateway=' + escape(gatewayip) + '&type=' + escape(addrtype);
|
1690
|
var myAjax = new Ajax.Request(
|
1691
|
url,
|
1692
|
{
|
1693
|
method: 'post',
|
1694
|
parameters: pars,
|
1695
|
onFailure: report_failure,
|
1696
|
onComplete: save_callback
|
1697
|
});
|
1698
|
}
|
1699
|
function addOption(selectbox,text,value)
|
1700
|
{
|
1701
|
var optn = document.createElement("OPTION");
|
1702
|
optn.text = text;
|
1703
|
optn.value = value;
|
1704
|
selectbox.options.add(optn);
|
1705
|
selectbox.selectedIndex = (selectbox.options.length-1);
|
1706
|
$('notebox').innerHTML="<p/><strong>NOTE:</strong> You can manage Gateways <a target='_new' href='system_gateways.php'>here</a>.";
|
1707
|
}
|
1708
|
function report_failure() {
|
1709
|
alert("Sorry, we could not create your gateway at this time.");
|
1710
|
hide_add_gateway();
|
1711
|
}
|
1712
|
function save_callback(transport) {
|
1713
|
var response = transport.responseText;
|
1714
|
if(response) {
|
1715
|
document.getElementById("addgateway").style.display = 'none';
|
1716
|
hide_add_gateway();
|
1717
|
$('status').innerHTML = '';
|
1718
|
addOption($('gateway'), name, name);
|
1719
|
// Auto submit form?
|
1720
|
//document.iform.submit();
|
1721
|
//$('status').innerHTML = '<img src="/themes/metallic/images/misc/loader.gif">';
|
1722
|
} else {
|
1723
|
report_failure();
|
1724
|
}
|
1725
|
}
|
1726
|
<?php
|
1727
|
if ($if == "wan" || $if == "lan")
|
1728
|
echo "\$('allcfg').show();";
|
1729
|
else
|
1730
|
echo "show_allcfg(document.iform.enable);";
|
1731
|
echo "updateType('{$pconfig['type']}')";
|
1732
|
?>
|
1733
|
</script>
|
1734
|
<?php include("fend.inc"); ?>
|
1735
|
</body>
|
1736
|
</html>
|