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