1 |
8a9edda5
|
Scott Ullrich
|
<?php
|
2 |
5b237745
|
Scott Ullrich
|
/*
|
3 |
aaec5634
|
Renato Botelho
|
* interfaces.php
|
4 |
9da2cf1c
|
Stephen Beaver
|
*
|
5 |
aaec5634
|
Renato Botelho
|
* 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 |
fd9ebcd5
|
Stephen Beaver
|
*
|
10 |
aaec5634
|
Renato Botelho
|
* originally based on m0n0wall (http://m0n0.ch/wall)
|
11 |
|
|
* Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
12 |
|
|
* All rights reserved.
|
13 |
fd9ebcd5
|
Stephen Beaver
|
*
|
14 |
aaec5634
|
Renato Botelho
|
* Redistribution and use in source and binary forms, with or without
|
15 |
|
|
* modification, are permitted provided that the following conditions are met:
|
16 |
fd9ebcd5
|
Stephen Beaver
|
*
|
17 |
aaec5634
|
Renato Botelho
|
* 1. Redistributions of source code must retain the above copyright notice,
|
18 |
|
|
* this list of conditions and the following disclaimer.
|
19 |
fd9ebcd5
|
Stephen Beaver
|
*
|
20 |
aaec5634
|
Renato Botelho
|
* 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 |
fd9ebcd5
|
Stephen Beaver
|
*
|
25 |
aaec5634
|
Renato Botelho
|
* 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 |
fd9ebcd5
|
Stephen Beaver
|
*
|
30 |
aaec5634
|
Renato Botelho
|
* 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 |
fd9ebcd5
|
Stephen Beaver
|
*
|
35 |
aaec5634
|
Renato Botelho
|
* 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 |
fd9ebcd5
|
Stephen Beaver
|
*
|
39 |
aaec5634
|
Renato Botelho
|
* 6. Redistributions of any form whatsoever must retain the following
|
40 |
|
|
* acknowledgment:
|
41 |
fd9ebcd5
|
Stephen Beaver
|
*
|
42 |
aaec5634
|
Renato Botelho
|
* "This product includes software developed by the pfSense Project
|
43 |
|
|
* for use in the pfSense software distribution (http://www.pfsense.org/).
|
44 |
fd9ebcd5
|
Stephen Beaver
|
*
|
45 |
aaec5634
|
Renato Botelho
|
* 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 |
fd9ebcd5
|
Stephen Beaver
|
*/
|
58 |
5b237745
|
Scott Ullrich
|
|
59 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
60 |
01eb687d
|
Ermal Luçi
|
##|*IDENT=page-interfaces
|
61 |
5230f468
|
jim-p
|
##|*NAME=Interfaces: WAN
|
62 |
998552f8
|
Ermal Luçi
|
##|*DESCR=Allow access to the 'Interfaces' page.
|
63 |
01eb687d
|
Ermal Luçi
|
##|*MATCH=interfaces.php*
|
64 |
6b07c15a
|
Matthew Grooms
|
##|-PRIV
|
65 |
|
|
|
66 |
f81cfcc9
|
jim-p
|
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 |
1fb064e8
|
Erik Fonnesbeck
|
require_once("xmlparse_attr.inc");
|
75 |
199d8121
|
Ermal Luçi
|
|
76 |
6dee9957
|
Stephen Beaver
|
define("ANTENNAS", false);
|
77 |
ae4c4bac
|
Stephen Beaver
|
|
78 |
5eabad3d
|
Phil Davis
|
if (isset($_POST['referer'])) {
|
79 |
68933ba7
|
Stephen Beaver
|
$referer = $_POST['referer'];
|
80 |
5eabad3d
|
Phil Davis
|
} else {
|
81 |
68933ba7
|
Stephen Beaver
|
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/interfaces.php');
|
82 |
5eabad3d
|
Phil Davis
|
}
|
83 |
62424bdb
|
Renato Botelho
|
|
84 |
94556105
|
Scott Ullrich
|
// Get configured interface list
|
85 |
dd18038e
|
Ermal
|
$ifdescrs = get_configured_interface_with_descr(false, true);
|
86 |
94556105
|
Scott Ullrich
|
|
87 |
dd18038e
|
Ermal
|
$if = "wan";
|
88 |
1caf2209
|
Phil Davis
|
if ($_REQUEST['if']) {
|
89 |
68933ba7
|
Stephen Beaver
|
$if = $_REQUEST['if'];
|
90 |
1caf2209
|
Phil Davis
|
}
|
91 |
dd18038e
|
Ermal
|
|
92 |
|
|
if (empty($ifdescrs[$if])) {
|
93 |
68933ba7
|
Stephen Beaver
|
header("Location: interfaces.php");
|
94 |
|
|
exit;
|
95 |
9ff9a1c7
|
Seth Mos
|
}
|
96 |
6b07c15a
|
Matthew Grooms
|
|
97 |
58af5941
|
Scott Ullrich
|
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 |
dc711694
|
Scott Ullrich
|
|
102 |
1caf2209
|
Phil Davis
|
if (!is_array($pconfig)) {
|
103 |
68933ba7
|
Stephen Beaver
|
$pconfig = array();
|
104 |
1caf2209
|
Phil Davis
|
}
|
105 |
89c7a9c8
|
Ermal
|
|
106 |
1caf2209
|
Phil Davis
|
if (!is_array($config['ppps'])) {
|
107 |
68933ba7
|
Stephen Beaver
|
$config['ppps'] = array();
|
108 |
1caf2209
|
Phil Davis
|
}
|
109 |
|
|
if (!is_array($config['ppps']['ppp'])) {
|
110 |
68933ba7
|
Stephen Beaver
|
$config['ppps']['ppp'] = array();
|
111 |
1caf2209
|
Phil Davis
|
}
|
112 |
d85ba87f
|
gnhb
|
$a_ppps = &$config['ppps']['ppp'];
|
113 |
58af5941
|
Scott Ullrich
|
|
114 |
f1f60c92
|
Ermal Luçi
|
function remove_bad_chars($string) {
|
115 |
68933ba7
|
Stephen Beaver
|
return preg_replace('/[^a-z_0-9]/i', '', $string);
|
116 |
f1f60c92
|
Ermal Luçi
|
}
|
117 |
|
|
|
118 |
1caf2209
|
Phil Davis
|
if (!is_array($config['gateways']['gateway_item'])) {
|
119 |
68933ba7
|
Stephen Beaver
|
$config['gateways']['gateway_item'] = array();
|
120 |
1caf2209
|
Phil Davis
|
}
|
121 |
564599fa
|
Stephen Beaver
|
|
122 |
d173230c
|
Seth Mos
|
$a_gateways = &$config['gateways']['gateway_item'];
|
123 |
|
|
|
124 |
f1f60c92
|
Ermal Luçi
|
$wancfg = &$config['interfaces'][$if];
|
125 |
ee5c01b5
|
Seth Mos
|
$old_wancfg = $wancfg;
|
126 |
e12ad49f
|
Renato Botelho
|
$old_wancfg['realif'] = get_real_interface($if);
|
127 |
|
|
$old_ppps = $a_ppps;
|
128 |
564599fa
|
Stephen Beaver
|
|
129 |
dd18038e
|
Ermal
|
// Populate page descr if it does not exist.
|
130 |
1caf2209
|
Phil Davis
|
if ($if == "wan" && !$wancfg['descr']) {
|
131 |
68933ba7
|
Stephen Beaver
|
$wancfg['descr'] = "WAN";
|
132 |
1caf2209
|
Phil Davis
|
} else if ($if == "lan" && !$wancfg['descr']) {
|
133 |
68933ba7
|
Stephen Beaver
|
$wancfg['descr'] = "LAN";
|
134 |
1caf2209
|
Phil Davis
|
}
|
135 |
dd18038e
|
Ermal
|
|
136 |
c4642eb1
|
Ermal LUÇI
|
/* NOTE: The code here is used to set the $pppid for the curious */
|
137 |
8256f324
|
gnhb
|
foreach ($a_ppps as $pppid => $ppp) {
|
138 |
68933ba7
|
Stephen Beaver
|
if ($wancfg['if'] == $ppp['if']) {
|
139 |
|
|
break;
|
140 |
|
|
}
|
141 |
30ade846
|
gnhb
|
}
|
142 |
|
|
|
143 |
c4b60a9a
|
Colin Fleming
|
$type_disabled = (substr($wancfg['if'], 0, 3) == 'gre') ? 'disabled' : '';
|
144 |
f3d88511
|
Renato Botelho
|
|
145 |
1d7e1d6c
|
gnhb
|
if ($wancfg['if'] == $a_ppps[$pppid]['if']) {
|
146 |
68933ba7
|
Stephen Beaver
|
$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 |
66fd7b47
|
Phil Davis
|
$pconfig['pptp_localip'] = explode(",", $a_ppps[$pppid]['localip']);
|
210 |
68933ba7
|
Stephen Beaver
|
$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 |
8256f324
|
gnhb
|
} else {
|
216 |
68933ba7
|
Stephen Beaver
|
$pconfig['ptpid'] = interfaces_ptpid_next();
|
217 |
|
|
$pppid = count($a_ppps);
|
218 |
d85ba87f
|
gnhb
|
}
|
219 |
564599fa
|
Stephen Beaver
|
|
220 |
5b237745
|
Scott Ullrich
|
$pconfig['dhcphostname'] = $wancfg['dhcphostname'];
|
221 |
bc40d758
|
Seth Mos
|
$pconfig['alias-address'] = $wancfg['alias-address'];
|
222 |
|
|
$pconfig['alias-subnet'] = $wancfg['alias-subnet'];
|
223 |
57c83fd6
|
jim-p
|
$pconfig['dhcprejectfrom'] = $wancfg['dhcprejectfrom'];
|
224 |
f4dd8b4c
|
N0YB
|
|
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 |
e4d40f41
|
gnhb
|
$pconfig['dhcp_plus'] = isset($wancfg['dhcp_plus']);
|
279 |
f1f60c92
|
Ermal Luçi
|
$pconfig['descr'] = remove_bad_chars($wancfg['descr']);
|
280 |
6a688547
|
Ermal
|
$pconfig['enable'] = isset($wancfg['enable']);
|
281 |
f1f60c92
|
Ermal Luçi
|
|
282 |
1caf2209
|
Phil Davis
|
switch ($wancfg['ipaddr']) {
|
283 |
68933ba7
|
Stephen Beaver
|
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 |
9ff9a1c7
|
Seth Mos
|
}
|
303 |
5b237745
|
Scott Ullrich
|
|
304 |
1caf2209
|
Phil Davis
|
switch ($wancfg['ipaddrv6']) {
|
305 |
68933ba7
|
Stephen Beaver
|
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 |
3363c02b
|
k-paulius
|
$pconfig['dhcp6debug'] = isset($wancfg['dhcp6debug']);
|
319 |
f50f74a4
|
Phil Davis
|
$pconfig['dhcp6withoutra'] = isset($wancfg['dhcp6withoutra']);
|
320 |
68933ba7
|
Stephen Beaver
|
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 |
47593ac6
|
Seth Mos
|
}
|
354 |
|
|
|
355 |
5b237745
|
Scott Ullrich
|
$pconfig['blockpriv'] = isset($wancfg['blockpriv']);
|
356 |
ff1955ee
|
Bill Marquette
|
$pconfig['blockbogons'] = isset($wancfg['blockbogons']);
|
357 |
5b237745
|
Scott Ullrich
|
$pconfig['spoofmac'] = $wancfg['spoofmac'];
|
358 |
|
|
$pconfig['mtu'] = $wancfg['mtu'];
|
359 |
4cea5cf8
|
Ermal
|
$pconfig['mss'] = $wancfg['mss'];
|
360 |
5b237745
|
Scott Ullrich
|
|
361 |
|
|
/* Wireless interface? */
|
362 |
b7f01f59
|
Bill Marquette
|
if (isset($wancfg['wireless'])) {
|
363 |
68933ba7
|
Stephen Beaver
|
/* 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 |
5b237745
|
Scott Ullrich
|
}
|
440 |
|
|
|
441 |
43e255d2
|
Ermal Luçi
|
if ($_POST['apply']) {
|
442 |
68933ba7
|
Stephen Beaver
|
unset($input_errors);
|
443 |
|
|
if (!is_subsystem_dirty('interfaces')) {
|
444 |
eaa948d6
|
NOYB
|
$input_errors[] = gettext("The settings have already been applied!");
|
445 |
68933ba7
|
Stephen Beaver
|
} 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 |
3a8a9028
|
Chris Buechler
|
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 |
0a52ea65
|
Stephen Beaver
|
that skips bridge membership addition.
|
460 |
3a8a9028
|
Chris Buechler
|
*/
|
461 |
|
|
$wancfg = $config['interfaces'][$ifapply];
|
462 |
|
|
interface_track6_configure($ifapply, $wancfg, true);
|
463 |
|
|
}
|
464 |
68933ba7
|
Stephen Beaver
|
} else {
|
465 |
|
|
interface_bring_down($ifapply, true, $ifcfgo);
|
466 |
|
|
if (isset($config['dhcpd'][$ifapply]['enable']) ||
|
467 |
aa82505e
|
Phil Davis
|
isset($config['dhcpdv6'][$ifapply]['enable'])) {
|
468 |
68933ba7
|
Stephen Beaver
|
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 |
dd18038e
|
Ermal
|
} else if ($_POST) {
|
493 |
270c4607
|
Scott Ullrich
|
|
494 |
68933ba7
|
Stephen Beaver
|
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 |
f8bf3fe8
|
Phil Davis
|
|
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 |
b824f18c
|
Renato Botelho
|
/* 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 |
68933ba7
|
Stephen Beaver
|
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 |
5d314c0a
|
Chris Buechler
|
if (isset($config['dhcpdv6']) && isset($config['dhcpdv6'][$if]['enable']) && ($_POST['type6'] != "staticv6" && $_POST['type6'] != "track6")) {
|
554 |
68933ba7
|
Stephen Beaver
|
$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 |
66fd7b47
|
Phil Davis
|
$reqdfields = explode(" ", "pptp_username pptp_password pptp_local0 pptp_subnet0 pptp_remote0 pptp_dialondemand pptp_idletimeout");
|
590 |
68933ba7
|
Stephen Beaver
|
$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 |
ca28c12c
|
Phil Davis
|
$reqdfields = explode(" ", "pptp_username pptp_password pptp_local0 pptp_subnet0 pptp_remote0");
|
593 |
68933ba7
|
Stephen Beaver
|
$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 |
66fd7b47
|
Phil Davis
|
$reqdfields = explode(" ", "pptp_username pptp_password pptp_remote0 pptp_dialondemand pptp_idletimeout");
|
600 |
68933ba7
|
Stephen Beaver
|
$reqdfieldsn = array(gettext("L2TP username"), gettext("L2TP password"), gettext("L2TP remote IP address"), gettext("Dial on demand"), gettext("Idle timeout value"));
|
601 |
|
|
} else {
|
602 |
66fd7b47
|
Phil Davis
|
$reqdfields = explode(" ", "pptp_username pptp_password pptp_remote0");
|
603 |
68933ba7
|
Stephen Beaver
|
$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 |
e4517c3c
|
jim-p
|
$input_errors[] = sprintf(gettext("The interface must be reassigned to configure as %s."), $_POST['type6']);
|
626 |
68933ba7
|
Stephen Beaver
|
}
|
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 |
e4517c3c
|
jim-p
|
$input_errors[] = gettext("Only one interface can be configured within a single 6rd prefix.");
|
636 |
68933ba7
|
Stephen Beaver
|
break;
|
637 |
|
|
}
|
638 |
|
|
}
|
639 |
|
|
}
|
640 |
2239959d
|
Chris Buechler
|
if (!is_ipaddrv4($_POST['gateway-6rd'])) {
|
641 |
3c596efc
|
Chris Buechler
|
$input_errors[] = gettext("6RD Border Gateway must be an IPv4 address.");
|
642 |
|
|
}
|
643 |
68933ba7
|
Stephen Beaver
|
if (in_array($wancfg['ipaddrv6'], array())) {
|
644 |
e4517c3c
|
jim-p
|
$input_errors[] = sprintf(gettext("The interface must be reassigned to configure as %s."), $_POST['type6']);
|
645 |
68933ba7
|
Stephen Beaver
|
}
|
646 |
|
|
break;
|
647 |
|
|
case "6to4":
|
648 |
|
|
foreach ($ifdescrs as $ifent => $ifdescr) {
|
649 |
|
|
if ($if != $ifent && ($config[interfaces][$ifent]['ipaddrv6'] == $_POST['type6'])) {
|
650 |
eaa948d6
|
NOYB
|
$input_errors[] = sprintf(gettext("Only one interface can be configured as 6to4."), $_POST['type6']);
|
651 |
68933ba7
|
Stephen Beaver
|
break;
|
652 |
|
|
}
|
653 |
|
|
}
|
654 |
|
|
if (in_array($wancfg['ipaddrv6'], array())) {
|
655 |
e4517c3c
|
jim-p
|
$input_errors[] = sprintf(gettext("The interface must be reassigned to configure as %s."), $_POST['type6']);
|
656 |
68933ba7
|
Stephen Beaver
|
}
|
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 |
e4517c3c
|
jim-p
|
$input_errors[] = sprintf(gettext("The interface must be reassigned to configure as %s."), $_POST['type6']);
|
662 |
68933ba7
|
Stephen Beaver
|
}
|
663 |
|
|
|
664 |
f09d4db4
|
Renato Botelho
|
if (empty($_POST['track6-interface'])) {
|
665 |
eaa948d6
|
NOYB
|
$input_errors[] = gettext("A valid interface to track must be selected.");
|
666 |
f09d4db4
|
Renato Botelho
|
}
|
667 |
|
|
|
668 |
68933ba7
|
Stephen Beaver
|
if ($_POST['track6-prefix-id--hex'] != "" && !is_numeric("0x" . $_POST['track6-prefix-id--hex'])) {
|
669 |
eaa948d6
|
NOYB
|
$input_errors[] = gettext("A valid hexadecimal number must be entered for the IPv6 prefix ID.");
|
670 |
68933ba7
|
Stephen Beaver
|
} 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 |
e4517c3c
|
jim-p
|
$input_errors[] = gettext("The specified IPv6 Prefix ID is out of range.") .
|
674 |
68933ba7
|
Stephen Beaver
|
" ({$_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 |
aa82505e
|
Phil Davis
|
$config['interfaces'][$ifent]['track6-interface'] == $_POST['track6-interface'] &&
|
682 |
|
|
$config['interfaces'][$ifent]['track6-prefix-id'] == $track6_prefix_id) {
|
683 |
68933ba7
|
Stephen Beaver
|
$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 |
352f8085
|
Chris Buechler
|
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 |
68933ba7
|
Stephen Beaver
|
$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 |
aa82505e
|
Phil Davis
|
$_POST['pppoe_resethour'] >= 0 && $_POST['pppoe_resethour'] <=23) {
|
791 |
|
|
$input_errors[] = gettext("A valid PPPoE reset hour must be specified (0-23).");
|
792 |
68933ba7
|
Stephen Beaver
|
}
|
793 |
|
|
if ($_POST['pppoe_resetminute'] != "" && !is_numericint($_POST['pppoe_resetminute']) &&
|
794 |
aa82505e
|
Phil Davis
|
$_POST['pppoe_resetminute'] >= 0 && $_POST['pppoe_resetminute'] <=59) {
|
795 |
|
|
$input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59).");
|
796 |
68933ba7
|
Stephen Beaver
|
}
|
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 |
66fd7b47
|
Phil Davis
|
if (($_POST['pptp_local0'] && !is_ipaddrv4($_POST['pptp_local0']))) {
|
801 |
68933ba7
|
Stephen Beaver
|
$input_errors[] = gettext("A valid PPTP local IP address must be specified.");
|
802 |
|
|
}
|
803 |
66fd7b47
|
Phil Davis
|
if (($_POST['pptp_subnet0'] && !is_numeric($_POST['pptp_subnet0']))) {
|
804 |
68933ba7
|
Stephen Beaver
|
$input_errors[] = gettext("A valid PPTP subnet bit count must be specified.");
|
805 |
|
|
}
|
806 |
8d89682e
|
Phil Davis
|
if (($_POST['pptp_remote0'] && !is_ipaddrv4($_POST['pptp_remote0']) && !is_hostname($_POST['pptp_remote0']))) {
|
807 |
68933ba7
|
Stephen Beaver
|
$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 |
4a3a45c4
|
Luiz Otavio O Souza
|
$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 |
68933ba7
|
Stephen Beaver
|
} 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 |
4a3a45c4
|
Luiz Otavio O Souza
|
$input_errors[] = sprintf(gettext("Interface %s (VLAN) has MTU set to a larger value."), $ifdata['descr']);
|
861 |
68933ba7
|
Stephen Beaver
|
}
|
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 |
c8b10b4c
|
Stephen Beaver
|
|
960 |
|
|
if ($_POST['ppp_password'] != $_POST['ppp_password_confirm']) {
|
961 |
|
|
$input_errors[] = gettext("PPP Password and confirmed password must match!");
|
962 |
|
|
}
|
963 |
|
|
|
964 |
6fb95fa2
|
heper
|
if ($_POST['pppoe_password'] != $_POST['pppoe_password_confirm']) {
|
965 |
c8b10b4c
|
Stephen Beaver
|
$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 |
68933ba7
|
Stephen Beaver
|
if (!$input_errors) {
|
973 |
66fd7b47
|
Phil Davis
|
// 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 |
68933ba7
|
Stephen Beaver
|
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 |
3363c02b
|
k-paulius
|
unset($wancfg['dhcp6debug']);
|
1012 |
68933ba7
|
Stephen Beaver
|
unset($wancfg['track6-interface']);
|
1013 |
|
|
unset($wancfg['track6-prefix-id']);
|
1014 |
f50f74a4
|
Phil Davis
|
unset($wancfg['dhcp6withoutra']);
|
1015 |
68933ba7
|
Stephen Beaver
|
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 |
76d6d925
|
Stephen Beaver
|
if ($_POST['ppp_password'] != DMYPWD) {
|
1153 |
|
|
$a_ppps[$pppid]['password'] = base64_encode($_POST['ppp_password']);
|
1154 |
|
|
}
|
1155 |
68933ba7
|
Stephen Beaver
|
$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 |
76d6d925
|
Stephen Beaver
|
if ($_POST['pppoe_password'] != DMYPWD) {
|
1172 |
|
|
$a_ppps[$pppid]['password'] = base64_encode($_POST['pppoe_password']);
|
1173 |
|
|
}
|
1174 |
68933ba7
|
Stephen Beaver
|
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 |
76d6d925
|
Stephen Beaver
|
if ($_POST['pptp_password'] != DMYPWD) {
|
1210 |
|
|
$a_ppps[$pppid]['password'] = base64_encode($_POST['pptp_password']);
|
1211 |
|
|
}
|
1212 |
66fd7b47
|
Phil Davis
|
// 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 |
68933ba7
|
Stephen Beaver
|
$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 |
3363c02b
|
k-paulius
|
if ($_POST['dhcp6debug'] == "yes") {
|
1259 |
|
|
$wancfg['dhcp6debug'] = true;
|
1260 |
|
|
}
|
1261 |
68933ba7
|
Stephen Beaver
|
|
1262 |
f50f74a4
|
Phil Davis
|
if ($_POST['dhcp6withoutra'] == "yes") {
|
1263 |
|
|
$wancfg['dhcp6withoutra'] = true;
|
1264 |
|
|
}
|
1265 |
|
|
|
1266 |
68933ba7
|
Stephen Beaver
|
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 |
c0948c6c
|
Renato Botelho
|
|
1449 |
1caf2209
|
Phil Davis
|
} // end if ($_POST)
|
1450 |
270c4607
|
Scott Ullrich
|
|
1451 |
25a6411a
|
Scott Ullrich
|
function handle_wireless_post() {
|
1452 |
68933ba7
|
Stephen Beaver
|
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 |
5b237745
|
Scott Ullrich
|
}
|
1602 |
7f43ca88
|
Scott Ullrich
|
|
1603 |
597330aa
|
Erik Fonnesbeck
|
function check_wireless_mode() {
|
1604 |
68933ba7
|
Stephen Beaver
|
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 |
e4517c3c
|
jim-p
|
$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 |
68933ba7
|
Stephen Beaver
|
} else {
|
1630 |
|
|
mwexec("/sbin/ifconfig " . escapeshellarg($wlanif) . "_ destroy");
|
1631 |
|
|
}
|
1632 |
|
|
$wancfg['wireless']['mode'] = $old_wireless_mode;
|
1633 |
|
|
}
|
1634 |
597330aa
|
Erik Fonnesbeck
|
}
|
1635 |
|
|
|
1636 |
509ca889
|
Evgeny Yurchenko
|
// 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 |
1caf2209
|
Phil Davis
|
foreach ($mediaopts as $mediaopt) {
|
1641 |
68933ba7
|
Stephen Beaver
|
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 |
509ca889
|
Evgeny Yurchenko
|
}
|
1650 |
|
|
|
1651 |
7d5b2133
|
Phil Davis
|
$pgtitle = array(gettext("Interfaces"), $wancfg['descr']);
|
1652 |
b32dd0a6
|
jim-p
|
$shortcut_section = "interfaces";
|
1653 |
af1e2031
|
jim-p
|
|
1654 |
3e662cb0
|
Ermal
|
$types4 = array("none" => gettext("None"), "staticv4" => gettext("Static IPv4"), "dhcp" => gettext("DHCP"), "ppp" => gettext("PPP"), "pppoe" => gettext("PPPoE"), "pptp" => gettext("PPTP"), "l2tp" => gettext("L2TP"));
|
1655 |
feb88a14
|
smos
|
$types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"), "dhcp6" => gettext("DHCP6"), "slaac" => gettext("SLAAC"), "6rd" => gettext("6rd Tunnel"), "6to4" => gettext("6to4 Tunnel"), "track6" => gettext("Track Interface"));
|
1656 |
7f43ca88
|
Scott Ullrich
|
|
1657 |
ae4c4bac
|
Stephen Beaver
|
// Get the MAC address
|
1658 |
|
|
$ip = $_SERVER['REMOTE_ADDR'];
|
1659 |
|
|
$mymac = `/usr/sbin/arp -an | grep '('{$ip}')' | head -n 1 | cut -d" " -f4`;
|
1660 |
241111d7
|
Stephen Beaver
|
$mymac = str_replace("\n", "", $mymac);
|
1661 |
ae4c4bac
|
Stephen Beaver
|
|
1662 |
|
|
function build_mediaopts_list() {
|
1663 |
68933ba7
|
Stephen Beaver
|
global $mediaopts_list;
|
1664 |
a0509b13
|
Stephen Beaver
|
|
1665 |
0fc3de67
|
Phil Davis
|
$list = ["" => gettext("Default (no preference, typically autoselect)"),
|
1666 |
|
|
" " => gettext("------- Media Supported by this interface -------")
|
1667 |
68933ba7
|
Stephen Beaver
|
];
|
1668 |
a0509b13
|
Stephen Beaver
|
|
1669 |
68933ba7
|
Stephen Beaver
|
foreach ($mediaopts_list as $mediaopt) {
|
1670 |
|
|
$list[$mediaopt] = $mediaopt;
|
1671 |
|
|
}
|
1672 |
a0509b13
|
Stephen Beaver
|
|
1673 |
68933ba7
|
Stephen Beaver
|
return($list);
|
1674 |
ae4c4bac
|
Stephen Beaver
|
}
|
1675 |
9978e156
|
gnhb
|
|
1676 |
ae4c4bac
|
Stephen Beaver
|
function build_gateway_list() {
|
1677 |
9f3f4276
|
Stephen Beaver
|
global $a_gateways, $if;
|
1678 |
a0509b13
|
Stephen Beaver
|
|
1679 |
0fc3de67
|
Phil Davis
|
$list = array("none" => gettext("None"));
|
1680 |
68933ba7
|
Stephen Beaver
|
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 |
a0509b13
|
Stephen Beaver
|
|
1686 |
68933ba7
|
Stephen Beaver
|
return($list);
|
1687 |
ae4c4bac
|
Stephen Beaver
|
}
|
1688 |
1caf2209
|
Phil Davis
|
|
1689 |
9f3f4276
|
Stephen Beaver
|
function build_gatewayv6_list() {
|
1690 |
|
|
global $a_gateways, $if;
|
1691 |
|
|
|
1692 |
0fc3de67
|
Phil Davis
|
$list = array("none" => gettext("None"));
|
1693 |
9f3f4276
|
Stephen Beaver
|
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 |
ae4c4bac
|
Stephen Beaver
|
include("head.inc");
|
1703 |
4634cb48
|
Ermal Luçi
|
|
1704 |
aa82505e
|
Phil Davis
|
if ($input_errors) {
|
1705 |
68933ba7
|
Stephen Beaver
|
print_input_errors($input_errors);
|
1706 |
aa82505e
|
Phil Davis
|
}
|
1707 |
a0509b13
|
Stephen Beaver
|
|
1708 |
aa82505e
|
Phil Davis
|
if (is_subsystem_dirty('interfaces')) {
|
1709 |
3b3a95e5
|
Phil Davis
|
print_apply_box(sprintf(gettext("The %s configuration has been changed."), $wancfg['descr']) . "<br />" .
|
1710 |
e4517c3c
|
jim-p
|
gettext("The changes must be applied to take effect.") . "<br />" .
|
1711 |
f4bed461
|
k-paulius
|
gettext("Don't forget to adjust the DHCP Server range if needed after applying."));
|
1712 |
aa82505e
|
Phil Davis
|
}
|
1713 |
a0509b13
|
Stephen Beaver
|
|
1714 |
aa82505e
|
Phil Davis
|
if ($savemsg) {
|
1715 |
68933ba7
|
Stephen Beaver
|
print_info_box($savemsg, 'success');
|
1716 |
aa82505e
|
Phil Davis
|
}
|
1717 |
ae4c4bac
|
Stephen Beaver
|
|
1718 |
|
|
|
1719 |
8f58b51b
|
jim-p
|
$form = new Form();
|
1720 |
ae4c4bac
|
Stephen Beaver
|
|
1721 |
5f88f964
|
k-paulius
|
$section = new Form_Section('General Configuration');
|
1722 |
ae4c4bac
|
Stephen Beaver
|
|
1723 |
|
|
$section->addInput(new Form_Checkbox(
|
1724 |
68933ba7
|
Stephen Beaver
|
'enable',
|
1725 |
|
|
'Enable',
|
1726 |
|
|
'Enable interface',
|
1727 |
|
|
$pconfig['enable'],
|
1728 |
|
|
'yes'
|
1729 |
ae4c4bac
|
Stephen Beaver
|
));
|
1730 |
|
|
|
1731 |
|
|
$section->addInput(new Form_Input(
|
1732 |
68933ba7
|
Stephen Beaver
|
'descr',
|
1733 |
|
|
'Description',
|
1734 |
|
|
'text',
|
1735 |
|
|
$pconfig['descr']
|
1736 |
ae4c4bac
|
Stephen Beaver
|
))->setHelp('Enter a description (name) for the interface here.');
|
1737 |
|
|
|
1738 |
|
|
$section->addInput(new Form_Select(
|
1739 |
68933ba7
|
Stephen Beaver
|
'type',
|
1740 |
|
|
'IPv4 Configuration Type',
|
1741 |
|
|
$pconfig['type'],
|
1742 |
|
|
$types4
|
1743 |
ae4c4bac
|
Stephen Beaver
|
));
|
1744 |
|
|
|
1745 |
|
|
$section->addInput(new Form_Select(
|
1746 |
68933ba7
|
Stephen Beaver
|
'type6',
|
1747 |
|
|
'IPv6 Configuration Type',
|
1748 |
|
|
$pconfig['type6'],
|
1749 |
|
|
$types6
|
1750 |
ae4c4bac
|
Stephen Beaver
|
));
|
1751 |
|
|
|
1752 |
|
|
$macaddress = new Form_Input(
|
1753 |
b7ed9c48
|
Stephen Beaver
|
'spoofmac',
|
1754 |
68933ba7
|
Stephen Beaver
|
'MAC Address',
|
1755 |
|
|
'text',
|
1756 |
b7ed9c48
|
Stephen Beaver
|
$pconfig['spoofmac'],
|
1757 |
68933ba7
|
Stephen Beaver
|
['placeholder' => 'xx:xx:xx:xx:xx:xx']
|
1758 |
ae4c4bac
|
Stephen Beaver
|
);
|
1759 |
|
|
|
1760 |
|
|
$btnmymac = new Form_Button(
|
1761 |
68933ba7
|
Stephen Beaver
|
'btnmymac',
|
1762 |
faab522f
|
Renato Botelho
|
'Copy My MAC',
|
1763 |
827a3812
|
jim-p
|
null,
|
1764 |
|
|
'fa-clone'
|
1765 |
68933ba7
|
Stephen Beaver
|
);
|
1766 |
ae4c4bac
|
Stephen Beaver
|
|
1767 |
347c0214
|
Phil Davis
|
$btnmymac->setAttribute('type','button')->addClass('btn-success btn-sm');
|
1768 |
ae4c4bac
|
Stephen Beaver
|
|
1769 |
83e8a950
|
NOYB
|
$group = new Form_Group('MAC Address');
|
1770 |
ae4c4bac
|
Stephen Beaver
|
$group->add($macaddress);
|
1771 |
b4cb59ca
|
Stephen Beaver
|
// $group->add($btnmymac);
|
1772 |
a0509b13
|
Stephen Beaver
|
$group->setHelp('This field can be used to modify ("spoof") the MAC address of this interface.' . '<br />' .
|
1773 |
f7586fed
|
NOYB
|
'Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx or leave blank.');
|
1774 |
ae4c4bac
|
Stephen Beaver
|
$section->add($group);
|
1775 |
|
|
|
1776 |
692b5e02
|
Stephen Beaver
|
$section->addInput(new Form_Input(
|
1777 |
|
|
'mtu',
|
1778 |
|
|
'MTU',
|
1779 |
|
|
'number',
|
1780 |
|
|
$pconfig['mtu']
|
1781 |
eaa948d6
|
NOYB
|
))->setHelp('If this field is blank, the adapter\'s default MTU will be used. ' .
|
1782 |
692b5e02
|
Stephen Beaver
|
'This is typically 1500 bytes but can vary in some circumstances.');
|
1783 |
ae4c4bac
|
Stephen Beaver
|
|
1784 |
|
|
$section->addInput(new Form_Input(
|
1785 |
68933ba7
|
Stephen Beaver
|
'mss',
|
1786 |
|
|
'MSS',
|
1787 |
|
|
'number',
|
1788 |
|
|
$pconfig['mss']
|
1789 |
eaa948d6
|
NOYB
|
))->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 |
68933ba7
|
Stephen Beaver
|
'header size) will be in effect.');
|
1791 |
ae4c4bac
|
Stephen Beaver
|
|
1792 |
|
|
if (count($mediaopts_list) > 0) {
|
1793 |
68933ba7
|
Stephen Beaver
|
$section->addInput(new Form_Select(
|
1794 |
|
|
'mediaopt',
|
1795 |
|
|
'Speed and Duplex',
|
1796 |
0a52ea65
|
Stephen Beaver
|
rtrim($config['interfaces'][$if]['media'] . ' ' . $config['interfaces'][$if]['mediaopt']),
|
1797 |
68933ba7
|
Stephen Beaver
|
build_mediaopts_list()
|
1798 |
eaa948d6
|
NOYB
|
))->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 |
ae4c4bac
|
Stephen Beaver
|
}
|
1801 |
a0509b13
|
Stephen Beaver
|
|
1802 |
ae4c4bac
|
Stephen Beaver
|
$form->add($section);
|
1803 |
|
|
|
1804 |
5f88f964
|
k-paulius
|
$section = new Form_Section('Static IPv4 Configuration');
|
1805 |
3375f236
|
Stephen Beaver
|
$section->addClass('staticv4');
|
1806 |
ae4c4bac
|
Stephen Beaver
|
|
1807 |
|
|
$section->addInput(new Form_IpAddress(
|
1808 |
68933ba7
|
Stephen Beaver
|
'ipaddr',
|
1809 |
|
|
'IPv4 Address',
|
1810 |
|
|
$pconfig['ipaddr']
|
1811 |
ae4c4bac
|
Stephen Beaver
|
))->addMask('subnet', $pconfig['subnet'], 32);
|
1812 |
|
|
|
1813 |
|
|
$group = new Form_Group('IPv4 Upstream gateway');
|
1814 |
|
|
|
1815 |
|
|
$group->add(new Form_Select(
|
1816 |
68933ba7
|
Stephen Beaver
|
'gateway',
|
1817 |
|
|
'IPv4 Upstream Gateway',
|
1818 |
|
|
$pconfig['gateway'],
|
1819 |
|
|
build_gateway_list()
|
1820 |
ae4c4bac
|
Stephen Beaver
|
));
|
1821 |
|
|
|
1822 |
|
|
$group->add(new Form_Button(
|
1823 |
68933ba7
|
Stephen Beaver
|
'addgw',
|
1824 |
faab522f
|
Renato Botelho
|
'Add a new gateway',
|
1825 |
2e7fa7ca
|
jim-p
|
null,
|
1826 |
|
|
'fa-plus'
|
1827 |
347c0214
|
Phil Davis
|
))->setAttribute('type','button')->addClass('btn-success')->setAttribute('data-target', '#newgateway')->setAttribute('data-toggle', 'modal');
|
1828 |
aeeda8b4
|
Stephen Beaver
|
|
1829 |
ae4c4bac
|
Stephen Beaver
|
$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 |
25bbf8a1
|
jim-p
|
'On local area network interfaces the upstream gateway should be "none". ' .
|
1831 |
f7586fed
|
NOYB
|
gettext('Gateways can be managed by ') . '<a target="_blank" href="system_gateways.php">' . gettext(" clicking here") . '</a>.');
|
1832 |
ae4c4bac
|
Stephen Beaver
|
|
1833 |
|
|
$section->add($group);
|
1834 |
|
|
|
1835 |
aeeda8b4
|
Stephen Beaver
|
$form->add($section);
|
1836 |
ae4c4bac
|
Stephen Beaver
|
|
1837 |
5f88f964
|
k-paulius
|
$section = new Form_Section('Static IPv6 Configuration');
|
1838 |
3375f236
|
Stephen Beaver
|
$section->addClass('staticv6');
|
1839 |
ae4c4bac
|
Stephen Beaver
|
|
1840 |
|
|
$section->addInput(new Form_IpAddress(
|
1841 |
68933ba7
|
Stephen Beaver
|
'ipaddrv6',
|
1842 |
|
|
'IPv6 address',
|
1843 |
|
|
$pconfig['ipaddrv6']
|
1844 |
241111d7
|
Stephen Beaver
|
))->addMask('subnetv6', $pconfig['subnetv6'], 128);
|
1845 |
ae4c4bac
|
Stephen Beaver
|
|
1846 |
|
|
$group = new Form_Group('IPv6 Upstream gateway');
|
1847 |
|
|
|
1848 |
|
|
$group->add(new Form_Select(
|
1849 |
68933ba7
|
Stephen Beaver
|
'gatewayv6',
|
1850 |
2288d860
|
Stephen Beaver
|
'IPv6 Upstream Gateway',
|
1851 |
9f3f4276
|
Stephen Beaver
|
$pconfig['gatewayv6'],
|
1852 |
|
|
build_gatewayv6_list()
|
1853 |
ae4c4bac
|
Stephen Beaver
|
));
|
1854 |
|
|
|
1855 |
|
|
$group->add(new Form_Button(
|
1856 |
68933ba7
|
Stephen Beaver
|
'addgw6',
|
1857 |
faab522f
|
Renato Botelho
|
'Add a new gateway',
|
1858 |
2e7fa7ca
|
jim-p
|
null,
|
1859 |
|
|
'fa-plus'
|
1860 |
347c0214
|
Phil Davis
|
))->setAttribute('type','button')->addClass('btn-success')->setAttribute('data-target', '#newgateway6')->setAttribute('data-toggle', 'modal');
|
1861 |
ae4c4bac
|
Stephen Beaver
|
|
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 |
68933ba7
|
Stephen Beaver
|
'On local LANs the upstream gateway should be "none". ');
|
1864 |
a0509b13
|
Stephen Beaver
|
|
1865 |
8b5aac9f
|
Stephen Beaver
|
$section->add($group);
|
1866 |
|
|
$form->add($section);
|
1867 |
ae4c4bac
|
Stephen Beaver
|
|
1868 |
8b5aac9f
|
Stephen Beaver
|
// Add new gateway modal pop-up for IPv6
|
1869 |
5f88f964
|
k-paulius
|
$modal = new Modal('New IPv6 Gateway', 'newgateway6', 'large');
|
1870 |
8b5aac9f
|
Stephen Beaver
|
|
1871 |
|
|
$modal->addInput(new Form_Checkbox(
|
1872 |
68933ba7
|
Stephen Beaver
|
'defaultgw6',
|
1873 |
|
|
'Default',
|
1874 |
|
|
'Default gateway',
|
1875 |
|
|
($if == "wan" || $if == "WAN")
|
1876 |
ae4c4bac
|
Stephen Beaver
|
));
|
1877 |
|
|
|
1878 |
8b5aac9f
|
Stephen Beaver
|
$modal->addInput(new Form_Input(
|
1879 |
68933ba7
|
Stephen Beaver
|
'name6',
|
1880 |
|
|
'Gateway name',
|
1881 |
|
|
'text',
|
1882 |
4dda3174
|
Stephen Beaver
|
$wancfg['descr'] . "GWv6"
|
1883 |
8b5aac9f
|
Stephen Beaver
|
));
|
1884 |
ae4c4bac
|
Stephen Beaver
|
|
1885 |
8b5aac9f
|
Stephen Beaver
|
$modal->addInput(new Form_IpAddress(
|
1886 |
68933ba7
|
Stephen Beaver
|
'gatewayip6',
|
1887 |
4dda3174
|
Stephen Beaver
|
'Gateway IPv6',
|
1888 |
68933ba7
|
Stephen Beaver
|
null
|
1889 |
8b5aac9f
|
Stephen Beaver
|
));
|
1890 |
ae4c4bac
|
Stephen Beaver
|
|
1891 |
8b5aac9f
|
Stephen Beaver
|
$modal->addInput(new Form_Input(
|
1892 |
68933ba7
|
Stephen Beaver
|
'gatewaydescr6',
|
1893 |
|
|
'Description',
|
1894 |
|
|
'text'
|
1895 |
8b5aac9f
|
Stephen Beaver
|
));
|
1896 |
ae4c4bac
|
Stephen Beaver
|
|
1897 |
8b5aac9f
|
Stephen Beaver
|
$btnaddgw6 = new Form_Button(
|
1898 |
68933ba7
|
Stephen Beaver
|
'add6',
|
1899 |
faab522f
|
Renato Botelho
|
'Add',
|
1900 |
2e7fa7ca
|
jim-p
|
null,
|
1901 |
|
|
'fa-plus'
|
1902 |
8b5aac9f
|
Stephen Beaver
|
);
|
1903 |
ae4c4bac
|
Stephen Beaver
|
|
1904 |
347c0214
|
Phil Davis
|
$btnaddgw6->setAttribute('type','button')->addClass('btn-success');
|
1905 |
ae4c4bac
|
Stephen Beaver
|
|
1906 |
8b5aac9f
|
Stephen Beaver
|
$btncnxgw6 = new Form_Button(
|
1907 |
68933ba7
|
Stephen Beaver
|
'cnx6',
|
1908 |
faab522f
|
Renato Botelho
|
'Cancel',
|
1909 |
2e7fa7ca
|
jim-p
|
null,
|
1910 |
|
|
'fa-undo'
|
1911 |
8b5aac9f
|
Stephen Beaver
|
);
|
1912 |
|
|
|
1913 |
347c0214
|
Phil Davis
|
$btncnxgw6->setAttribute('type','button')->addClass('btn-warning');
|
1914 |
8b5aac9f
|
Stephen Beaver
|
|
1915 |
|
|
$modal->addInput(new Form_StaticText(
|
1916 |
68933ba7
|
Stephen Beaver
|
null,
|
1917 |
|
|
$btnaddgw6 . $btncnxgw6
|
1918 |
8b5aac9f
|
Stephen Beaver
|
));
|
1919 |
|
|
|
1920 |
|
|
$form->add($modal);
|
1921 |
ae4c4bac
|
Stephen Beaver
|
|
1922 |
|
|
// ==== DHCP client configuration =============================
|
1923 |
|
|
|
1924 |
5f88f964
|
k-paulius
|
$section = new Form_Section('DHCP Client Configuration');
|
1925 |
3375f236
|
Stephen Beaver
|
$section->addClass('dhcp');
|
1926 |
ae4c4bac
|
Stephen Beaver
|
|
1927 |
34ab580d
|
Stephen Beaver
|
$group = new Form_Group('Options');
|
1928 |
|
|
|
1929 |
|
|
$group->add(new Form_Checkbox(
|
1930 |
0c5916ce
|
NOYB
|
'adv_dhcp_config_advanced',
|
1931 |
34ab580d
|
Stephen Beaver
|
null,
|
1932 |
79a1a27f
|
NOYB
|
'Advanced Configuration',
|
1933 |
0c5916ce
|
NOYB
|
$pconfig['adv_dhcp_config_advanced']
|
1934 |
79a1a27f
|
NOYB
|
))->setHelp('Use advanced DHCP configuration options.');
|
1935 |
34ab580d
|
Stephen Beaver
|
|
1936 |
|
|
$group->add(new Form_Checkbox(
|
1937 |
0c5916ce
|
NOYB
|
'adv_dhcp_config_file_override',
|
1938 |
34ab580d
|
Stephen Beaver
|
null,
|
1939 |
79a1a27f
|
NOYB
|
'Configuration Override',
|
1940 |
0c5916ce
|
NOYB
|
$pconfig['adv_dhcp_config_file_override']
|
1941 |
79a1a27f
|
NOYB
|
))->setHelp('Override the configuration from this file.');
|
1942 |
34ab580d
|
Stephen Beaver
|
|
1943 |
|
|
$section->add($group);
|
1944 |
|
|
|
1945 |
ae4c4bac
|
Stephen Beaver
|
$section->addInput(new Form_Input(
|
1946 |
68933ba7
|
Stephen Beaver
|
'dhcphostname',
|
1947 |
|
|
'Hostname',
|
1948 |
|
|
'text',
|
1949 |
|
|
$pconfig['dhcphostname']
|
1950 |
ae4c4bac
|
Stephen Beaver
|
))->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 |
68933ba7
|
Stephen Beaver
|
'alias-address',
|
1954 |
|
|
'Alias IPv4 address',
|
1955 |
|
|
$pconfig['alias-address']
|
1956 |
ae4c4bac
|
Stephen Beaver
|
))->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 |
68933ba7
|
Stephen Beaver
|
'dhcprejectfrom',
|
1960 |
|
|
'Reject leases from',
|
1961 |
|
|
'text',
|
1962 |
|
|
$pconfig['dhcprejectfrom']
|
1963 |
d3225265
|
jim-p
|
))->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 |
ae4c4bac
|
Stephen Beaver
|
|
1966 |
|
|
$group = new Form_Group('Protocol timing');
|
1967 |
34ab580d
|
Stephen Beaver
|
$group->addClass('dhcpadvanced');
|
1968 |
ae4c4bac
|
Stephen Beaver
|
|
1969 |
|
|
$group->add(new Form_Input(
|
1970 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp_pt_timeout',
|
1971 |
|
|
null,
|
1972 |
|
|
'number',
|
1973 |
|
|
$pconfig['adv_dhcp_pt_timeout']
|
1974 |
ae4c4bac
|
Stephen Beaver
|
))->setHelp('Timeout');
|
1975 |
|
|
|
1976 |
|
|
$group->add(new Form_Input(
|
1977 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp_pt_retry',
|
1978 |
|
|
null,
|
1979 |
|
|
'number',
|
1980 |
|
|
$pconfig['adv_dhcp_pt_retry']
|
1981 |
ae4c4bac
|
Stephen Beaver
|
))->setHelp('Retry');
|
1982 |
|
|
|
1983 |
|
|
$group->add(new Form_Input(
|
1984 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp_pt_select_timeout',
|
1985 |
|
|
null,
|
1986 |
|
|
'number',
|
1987 |
a2239232
|
NOYB
|
$pconfig['adv_dhcp_pt_select_timeout'],
|
1988 |
|
|
['min' => 0]
|
1989 |
ae4c4bac
|
Stephen Beaver
|
))->setHelp('Select timeout');
|
1990 |
|
|
|
1991 |
|
|
$group->add(new Form_Input(
|
1992 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp_pt_reboot',
|
1993 |
|
|
null,
|
1994 |
|
|
'number',
|
1995 |
|
|
$pconfig['adv_dhcp_pt_reboot']
|
1996 |
ae4c4bac
|
Stephen Beaver
|
))->setHelp('Reboot');
|
1997 |
|
|
|
1998 |
|
|
$group->add(new Form_Input(
|
1999 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp_pt_backoff_cutoff',
|
2000 |
|
|
null,
|
2001 |
|
|
'number',
|
2002 |
|
|
$pconfig['adv_dhcp_pt_backoff_cutoff']
|
2003 |
ae4c4bac
|
Stephen Beaver
|
))->setHelp('Backoff cutoff');
|
2004 |
|
|
|
2005 |
|
|
$group->add(new Form_Input(
|
2006 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp_pt_initial_interval',
|
2007 |
|
|
null,
|
2008 |
|
|
'number',
|
2009 |
|
|
$pconfig['adv_dhcp_pt_initial_interval']
|
2010 |
ae4c4bac
|
Stephen Beaver
|
))->setHelp('Initial interval');
|
2011 |
|
|
|
2012 |
|
|
$section->add($group);
|
2013 |
|
|
|
2014 |
|
|
$group = new Form_Group('Presets');
|
2015 |
34ab580d
|
Stephen Beaver
|
$group->addClass('dhcpadvanced');
|
2016 |
ae4c4bac
|
Stephen Beaver
|
|
2017 |
|
|
$group->add(new Form_Checkbox(
|
2018 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp_pt_values',
|
2019 |
|
|
null,
|
2020 |
|
|
'FreeBSD default',
|
2021 |
|
|
null,
|
2022 |
|
|
'DHCP'
|
2023 |
ae4c4bac
|
Stephen Beaver
|
))->displayAsRadio();
|
2024 |
|
|
|
2025 |
|
|
$group->add(new Form_Checkbox(
|
2026 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp_pt_values',
|
2027 |
|
|
null,
|
2028 |
|
|
'Clear',
|
2029 |
|
|
null,
|
2030 |
|
|
'Clear'
|
2031 |
ae4c4bac
|
Stephen Beaver
|
))->displayAsRadio();
|
2032 |
|
|
|
2033 |
|
|
$group->add(new Form_Checkbox(
|
2034 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp_pt_values',
|
2035 |
|
|
null,
|
2036 |
|
|
'pfSense Default',
|
2037 |
|
|
null,
|
2038 |
|
|
'pfSense'
|
2039 |
ae4c4bac
|
Stephen Beaver
|
))->displayAsRadio();
|
2040 |
|
|
|
2041 |
|
|
$group->add(new Form_Checkbox(
|
2042 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp_pt_values',
|
2043 |
|
|
null,
|
2044 |
|
|
'Saved Cfg',
|
2045 |
|
|
null,
|
2046 |
|
|
'SavedCfg'
|
2047 |
ae4c4bac
|
Stephen Beaver
|
))->displayAsRadio();
|
2048 |
|
|
|
2049 |
|
|
$group->setHelp('The values in these fields are DHCP protocol timings used when requesting a lease.' . '<br />' .
|
2050 |
79a1a27f
|
NOYB
|
'<a target="_blank" href="https://www.freebsd.org/cgi/man.cgi?query=dhclient.conf&sektion=5#PROTOCOL_TIMING">' . 'See here more information' . '</a>');
|
2051 |
a0509b13
|
Stephen Beaver
|
|
2052 |
ae4c4bac
|
Stephen Beaver
|
$section->add($group);
|
2053 |
|
|
|
2054 |
34ab580d
|
Stephen Beaver
|
$section->addInput(new Form_Input(
|
2055 |
|
|
'adv_dhcp_config_file_override_path',
|
2056 |
79a1a27f
|
NOYB
|
'Configuration File Override',
|
2057 |
34ab580d
|
Stephen Beaver
|
'text',
|
2058 |
|
|
$pconfig['adv_dhcp_config_file_override_path']
|
2059 |
79a1a27f
|
NOYB
|
))->setWidth(9)->sethelp('The value in this field is the full absolute path to a DHCP client configuration file. [/[dirname/[.../]]filename[.ext]]' . '<br />' .
|
2060 |
34ab580d
|
Stephen Beaver
|
'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 |
ae4c4bac
|
Stephen Beaver
|
$form->add($section);
|
2065 |
|
|
|
2066 |
|
|
$section = new Form_Section('Lease Requirements and Requests');
|
2067 |
34ab580d
|
Stephen Beaver
|
$section->addClass('dhcpadvanced');
|
2068 |
ae4c4bac
|
Stephen Beaver
|
|
2069 |
|
|
$section->addInput(new Form_Input(
|
2070 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp_send_options',
|
2071 |
|
|
'Send options',
|
2072 |
|
|
'text',
|
2073 |
|
|
$pconfig['adv_dhcp_send_options']
|
2074 |
79a1a27f
|
NOYB
|
))->setWidth(9)->sethelp('The values in this field are DHCP options to be sent when requesting a DHCP lease. [option declaration [, ...]]' . '<br />' .
|
2075 |
68933ba7
|
Stephen Beaver
|
'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 |
ae4c4bac
|
Stephen Beaver
|
|
2079 |
|
|
$section->addInput(new Form_Input(
|
2080 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp_request_options',
|
2081 |
|
|
'Request options',
|
2082 |
|
|
'text',
|
2083 |
|
|
$pconfig['adv_dhcp_request_options']
|
2084 |
79a1a27f
|
NOYB
|
))->setWidth(9)->sethelp('The values in this field are DHCP option 55 to be sent when requesting a DHCP lease. [option [, ...]]' . '<br />' .
|
2085 |
68933ba7
|
Stephen Beaver
|
'Some ISPs may require certain options be or not be requested.');
|
2086 |
|
|
|
2087 |
|
|
$section->addInput(new Form_Input(
|
2088 |
0683ff17
|
NOYB
|
'adv_dhcp_required_options',
|
2089 |
583b40ee
|
Phil Davis
|
'Require options',
|
2090 |
68933ba7
|
Stephen Beaver
|
'text',
|
2091 |
0683ff17
|
NOYB
|
$pconfig['adv_dhcp_required_options']
|
2092 |
79a1a27f
|
NOYB
|
))->setWidth(9)->sethelp('The values in this field are DHCP options required by the client when requesting a DHCP lease. [option [, ...]]');
|
2093 |
ae4c4bac
|
Stephen Beaver
|
|
2094 |
|
|
$section->addInput(new Form_Input(
|
2095 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp_option_modifiers',
|
2096 |
|
|
'Option modifiers',
|
2097 |
|
|
'text',
|
2098 |
|
|
$pconfig['adv_dhcp_option_modifiers']
|
2099 |
f7586fed
|
NOYB
|
))->setWidth(9)->sethelp('The values in this field are DHCP option modifiers applied to the obtained DHCP lease. [modifier option declaration [, ...]]' . '<br />' .
|
2100 |
79a1a27f
|
NOYB
|
'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 |
ae4c4bac
|
Stephen Beaver
|
|
2103 |
|
|
$form->add($section);
|
2104 |
|
|
|
2105 |
|
|
// DHCP6 client config
|
2106 |
|
|
|
2107 |
5f88f964
|
k-paulius
|
$section = new Form_Section('DHCP6 Client Configuration');
|
2108 |
3375f236
|
Stephen Beaver
|
$section->addClass('dhcp6');
|
2109 |
|
|
|
2110 |
79a1a27f
|
NOYB
|
$group = new Form_Group('Options');
|
2111 |
|
|
|
2112 |
|
|
$group->add(new Form_Checkbox(
|
2113 |
7361f6c2
|
Stephen Beaver
|
'adv_dhcp6_config_advanced',
|
2114 |
79a1a27f
|
NOYB
|
null,
|
2115 |
|
|
'Advanced Configuration',
|
2116 |
0c5916ce
|
NOYB
|
$pconfig['adv_dhcp6_config_advanced']
|
2117 |
79a1a27f
|
NOYB
|
))->setHelp('Use advanced DHCPv6 configuration options.');
|
2118 |
309e8f8f
|
Stephen Beaver
|
|
2119 |
79a1a27f
|
NOYB
|
$group->add(new Form_Checkbox(
|
2120 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_config_file_override',
|
2121 |
79a1a27f
|
NOYB
|
null,
|
2122 |
|
|
'Configuration Override',
|
2123 |
0c5916ce
|
NOYB
|
$pconfig['adv_dhcp6_config_file_override']
|
2124 |
79a1a27f
|
NOYB
|
))->setHelp('Override the configuration from this file.');
|
2125 |
|
|
|
2126 |
|
|
$section->add($group);
|
2127 |
309e8f8f
|
Stephen Beaver
|
|
2128 |
ae4c4bac
|
Stephen Beaver
|
$section->addInput(new Form_Checkbox(
|
2129 |
68933ba7
|
Stephen Beaver
|
'dhcp6usev4iface',
|
2130 |
|
|
'Use IPv4 connectivity as parent interface',
|
2131 |
|
|
'Request a IPv6 prefix/information through the IPv4 connectivity link',
|
2132 |
|
|
$pconfig['dhcp6usev4iface']
|
2133 |
ae4c4bac
|
Stephen Beaver
|
));
|
2134 |
|
|
|
2135 |
|
|
$section->addInput(new Form_Checkbox(
|
2136 |
68933ba7
|
Stephen Beaver
|
'dhcp6prefixonly',
|
2137 |
|
|
'Request only an IPv6 prefix',
|
2138 |
|
|
'Only request an IPv6 prefix, do not request an IPv6 address',
|
2139 |
|
|
$pconfig['dhcp6prefixonly']
|
2140 |
ae4c4bac
|
Stephen Beaver
|
));
|
2141 |
|
|
|
2142 |
|
|
$section->addInput(new Form_Select(
|
2143 |
68933ba7
|
Stephen Beaver
|
'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 |
a0509b13
|
Stephen Beaver
|
))->setHelp('The value in this field is the delegated prefix length provided by the DHCPv6 server. Normally specified by the ISP.');
|
2148 |
ae4c4bac
|
Stephen Beaver
|
|
2149 |
|
|
$section->addInput(new Form_Checkbox(
|
2150 |
68933ba7
|
Stephen Beaver
|
'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 |
ae4c4bac
|
Stephen Beaver
|
));
|
2155 |
|
|
|
2156 |
3363c02b
|
k-paulius
|
$section->addInput(new Form_Checkbox(
|
2157 |
|
|
'dhcp6debug',
|
2158 |
|
|
'Debug',
|
2159 |
|
|
'Start DHCP6 client in debug mode',
|
2160 |
|
|
$pconfig['dhcp6debug']
|
2161 |
|
|
));
|
2162 |
|
|
|
2163 |
f50f74a4
|
Phil Davis
|
$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 |
309e8f8f
|
Stephen Beaver
|
$section->addInput(new Form_Input(
|
2171 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_config_file_override_path',
|
2172 |
|
|
'Configuration File Override',
|
2173 |
|
|
'text',
|
2174 |
|
|
$pconfig['adv_dhcp6_config_file_override_path']
|
2175 |
79a1a27f
|
NOYB
|
))->setWidth(9)->setHelp('The value in this field is the full absolute path to a DHCP client configuration file. [/[dirname/[.../]]filename[.ext]]' . '<br />' .
|
2176 |
68933ba7
|
Stephen Beaver
|
'Value Substitutions in Config File: {interface}, {hostname}, {mac_addr_asciiCD}, {mac_addr_hexCD}' . '<br />' .
|
2177 |
79a1a27f
|
NOYB
|
'Where C is U(pper) or L(ower) Case, and D is " :-." Delimiter (space, colon, hyphen, or period) (omitted for none).' . '<br />' .
|
2178 |
68933ba7
|
Stephen Beaver
|
'Some ISPs may require certain options be or not be sent.');
|
2179 |
309e8f8f
|
Stephen Beaver
|
|
2180 |
ae4c4bac
|
Stephen Beaver
|
$form->add($section);
|
2181 |
|
|
|
2182 |
|
|
// DHCP6 client config - Advanced
|
2183 |
|
|
|
2184 |
5f88f964
|
k-paulius
|
$section = new Form_Section('Advanced DHCP6 Client Configuration');
|
2185 |
309e8f8f
|
Stephen Beaver
|
$section->addClass('dhcp6advanced');
|
2186 |
3375f236
|
Stephen Beaver
|
|
2187 |
ae4c4bac
|
Stephen Beaver
|
$section->addInput(new Form_Checkbox(
|
2188 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_interface_statement_information_only_enable',
|
2189 |
|
|
'Information only',
|
2190 |
79a1a27f
|
NOYB
|
'Exchange Information Only',
|
2191 |
03911305
|
Stephen Beaver
|
$pconfig['adv_dhcp6_interface_statement_information_only_enable'],
|
2192 |
|
|
'Selected'
|
2193 |
79a1a27f
|
NOYB
|
))->setHelp('Only exchange informational configuration parameters with servers.');
|
2194 |
ae4c4bac
|
Stephen Beaver
|
|
2195 |
|
|
$section->addInput(new Form_Input(
|
2196 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_interface_statement_send_options',
|
2197 |
|
|
'Send options',
|
2198 |
|
|
'text',
|
2199 |
|
|
$pconfig['adv_dhcp6_interface_statement_send_options']
|
2200 |
79a1a27f
|
NOYB
|
))->setWidth(9)->sethelp('DHCP send options to be sent when requesting a DHCP lease. [option declaration [, ...]]' . '<br />' .
|
2201 |
68933ba7
|
Stephen Beaver
|
'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 |
ae4c4bac
|
Stephen Beaver
|
|
2205 |
|
|
$section->addInput(new Form_Input(
|
2206 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_interface_statement_request_options',
|
2207 |
|
|
'Request Options',
|
2208 |
|
|
'text',
|
2209 |
|
|
$pconfig['adv_dhcp6_interface_statement_request_options']
|
2210 |
79a1a27f
|
NOYB
|
))->setWidth(9)->sethelp('DHCP request options to be sent when requesting a DHCP lease. [option [, ...]]' . '<br />' .
|
2211 |
68933ba7
|
Stephen Beaver
|
'Some DHCP services may require certain options be or not be requested.');
|
2212 |
a0509b13
|
Stephen Beaver
|
|
2213 |
ae4c4bac
|
Stephen Beaver
|
$section->addInput(new Form_Input(
|
2214 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_interface_statement_script',
|
2215 |
|
|
'Scripts',
|
2216 |
|
|
'text',
|
2217 |
|
|
$pconfig['adv_dhcp6_interface_statement_script']
|
2218 |
79a1a27f
|
NOYB
|
))->setWidth(9)->sethelp('Absolute path to a script invoked on certain conditions including when a reply message is received.' . '<br />' .
|
2219 |
68933ba7
|
Stephen Beaver
|
'[/[dirname/[.../]]filename[.ext]].');
|
2220 |
a0509b13
|
Stephen Beaver
|
|
2221 |
ae4c4bac
|
Stephen Beaver
|
$group = new Form_Group('Identity Association Statement');
|
2222 |
|
|
|
2223 |
|
|
$group->add(new Form_Checkbox(
|
2224 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_id_assoc_statement_address_enable',
|
2225 |
|
|
null,
|
2226 |
|
|
'Non-Temporary Address Allocation',
|
2227 |
03911305
|
Stephen Beaver
|
$pconfig['adv_dhcp6_id_assoc_statement_address_enable'],
|
2228 |
|
|
'Selected'
|
2229 |
ae4c4bac
|
Stephen Beaver
|
));
|
2230 |
a0509b13
|
Stephen Beaver
|
|
2231 |
ae4c4bac
|
Stephen Beaver
|
$group->add(new Form_Input(
|
2232 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_id_assoc_statement_address_id',
|
2233 |
|
|
null,
|
2234 |
|
|
'text',
|
2235 |
|
|
$pconfig['adv_dhcp6_id_assoc_statement_address_id']
|
2236 |
ae4c4bac
|
Stephen Beaver
|
))->sethelp('id-assoc na ID');
|
2237 |
|
|
|
2238 |
|
|
$group->add(new Form_IpAddress(
|
2239 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_id_assoc_statement_address',
|
2240 |
|
|
null,
|
2241 |
|
|
$pconfig['adv_dhcp6_id_assoc_statement_address']
|
2242 |
ae4c4bac
|
Stephen Beaver
|
))->sethelp('IPv6 address');
|
2243 |
|
|
|
2244 |
|
|
$group->add(new Form_Input(
|
2245 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_id_assoc_statement_address_pltime',
|
2246 |
|
|
null,
|
2247 |
|
|
'text',
|
2248 |
|
|
$pconfig['adv_dhcp6_id_assoc_statement_address_pltime']
|
2249 |
ae4c4bac
|
Stephen Beaver
|
))->sethelp('pltime');
|
2250 |
|
|
|
2251 |
|
|
$group->add(new Form_Input(
|
2252 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_id_assoc_statement_address_vltime',
|
2253 |
|
|
null,
|
2254 |
|
|
'text',
|
2255 |
|
|
$pconfig['adv_dhcp6_id_assoc_statement_address_vltime']
|
2256 |
ae4c4bac
|
Stephen Beaver
|
))->sethelp('vltime');
|
2257 |
|
|
|
2258 |
|
|
$section->add($group);
|
2259 |
|
|
|
2260 |
a0509b13
|
Stephen Beaver
|
// Prefix delegation
|
2261 |
ae4c4bac
|
Stephen Beaver
|
$group = new Form_Group('');
|
2262 |
|
|
|
2263 |
|
|
$group->add(new Form_Checkbox(
|
2264 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_id_assoc_statement_prefix_enable',
|
2265 |
|
|
null,
|
2266 |
|
|
'Prefix Delegation ',
|
2267 |
03911305
|
Stephen Beaver
|
$pconfig['adv_dhcp6_id_assoc_statement_prefix_enable'],
|
2268 |
|
|
'Selected'
|
2269 |
ae4c4bac
|
Stephen Beaver
|
));
|
2270 |
a0509b13
|
Stephen Beaver
|
|
2271 |
ae4c4bac
|
Stephen Beaver
|
$group->add(new Form_Input(
|
2272 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_id_assoc_statement_prefix_id',
|
2273 |
|
|
null,
|
2274 |
|
|
'text',
|
2275 |
|
|
$pconfig['adv_dhcp6_id_assoc_statement_prefix_id']
|
2276 |
ae4c4bac
|
Stephen Beaver
|
))->sethelp('id-assoc pd ID');
|
2277 |
|
|
|
2278 |
|
|
$group->add(new Form_IpAddress(
|
2279 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_id_assoc_statement_prefix',
|
2280 |
|
|
null,
|
2281 |
|
|
$pconfig['adv_dhcp6_id_assoc_statement_prefix']
|
2282 |
ae4c4bac
|
Stephen Beaver
|
))->sethelp('IPv6 prefix');
|
2283 |
|
|
|
2284 |
|
|
$group->add(new Form_Input(
|
2285 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_id_assoc_statement_prefix_pltime',
|
2286 |
|
|
null,
|
2287 |
|
|
'text',
|
2288 |
|
|
$pconfig['adv_dhcp6_id_assoc_statement_prefix_pltime']
|
2289 |
ae4c4bac
|
Stephen Beaver
|
))->sethelp('pltime');
|
2290 |
|
|
|
2291 |
|
|
$group->add(new Form_Input(
|
2292 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_id_assoc_statement_prefix_vltime',
|
2293 |
|
|
null,
|
2294 |
|
|
'text',
|
2295 |
|
|
$pconfig['adv_dhcp6_id_assoc_statement_prefix_vltime']
|
2296 |
ae4c4bac
|
Stephen Beaver
|
))->sethelp('vltime');
|
2297 |
|
|
|
2298 |
|
|
$section->add($group);
|
2299 |
|
|
|
2300 |
|
|
$group = new Form_Group('Prefix interface statement');
|
2301 |
|
|
|
2302 |
|
|
$group->add(new Form_Input(
|
2303 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_prefix_interface_statement_sla_id',
|
2304 |
|
|
null,
|
2305 |
|
|
'text',
|
2306 |
|
|
$pconfig['adv_dhcp6_prefix_interface_statement_sla_id']
|
2307 |
ae4c4bac
|
Stephen Beaver
|
))->sethelp('Prefix Interface sla-id');
|
2308 |
|
|
|
2309 |
|
|
$group->add(new Form_Input(
|
2310 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_prefix_interface_statement_sla_len',
|
2311 |
|
|
null,
|
2312 |
|
|
'text',
|
2313 |
|
|
$pconfig['adv_dhcp6_prefix_interface_statement_sla_len']
|
2314 |
ae4c4bac
|
Stephen Beaver
|
))->sethelp('sla-len');
|
2315 |
|
|
|
2316 |
|
|
$section->add($group);
|
2317 |
|
|
|
2318 |
|
|
$group = new Form_Group('Authentication statement');
|
2319 |
|
|
|
2320 |
|
|
$group->add(new Form_Input(
|
2321 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_authentication_statement_authname',
|
2322 |
|
|
null,
|
2323 |
|
|
'text',
|
2324 |
|
|
$pconfig['adv_dhcp6_authentication_statement_authname']
|
2325 |
ae4c4bac
|
Stephen Beaver
|
))->sethelp('Authname');
|
2326 |
|
|
|
2327 |
|
|
$group->add(new Form_Input(
|
2328 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_authentication_statement_protocol',
|
2329 |
|
|
null,
|
2330 |
|
|
'text',
|
2331 |
|
|
$pconfig['adv_dhcp6_authentication_statement_protocol']
|
2332 |
ae4c4bac
|
Stephen Beaver
|
))->sethelp('Protocol');
|
2333 |
|
|
|
2334 |
|
|
$group->add(new Form_Input(
|
2335 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_authentication_statement_algorithm',
|
2336 |
|
|
null,
|
2337 |
|
|
'text',
|
2338 |
|
|
$pconfig['adv_dhcp6_authentication_statement_algorithm']
|
2339 |
ae4c4bac
|
Stephen Beaver
|
))->sethelp('Algorithm');
|
2340 |
|
|
|
2341 |
|
|
$group->add(new Form_Input(
|
2342 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_authentication_statement_rdm',
|
2343 |
|
|
null,
|
2344 |
|
|
'text',
|
2345 |
|
|
$pconfig['adv_dhcp6_authentication_statement_rdm']
|
2346 |
ae4c4bac
|
Stephen Beaver
|
))->sethelp('RDM');
|
2347 |
|
|
|
2348 |
|
|
$section->add($group);
|
2349 |
|
|
|
2350 |
|
|
$group = new Form_Group('Keyinfo statement');
|
2351 |
|
|
|
2352 |
|
|
$group->add(new Form_Input(
|
2353 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_key_info_statement_keyname',
|
2354 |
|
|
null,
|
2355 |
|
|
'text',
|
2356 |
|
|
$pconfig['adv_dhcp6_key_info_statement_keyname']
|
2357 |
ae4c4bac
|
Stephen Beaver
|
))->sethelp('Keyname');
|
2358 |
|
|
|
2359 |
|
|
$group->add(new Form_Input(
|
2360 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_key_info_statement_realm',
|
2361 |
|
|
null,
|
2362 |
|
|
'text',
|
2363 |
|
|
$pconfig['adv_dhcp6_key_info_statement_realm']
|
2364 |
ae4c4bac
|
Stephen Beaver
|
))->sethelp('Realm');
|
2365 |
|
|
|
2366 |
|
|
$section->add($group);
|
2367 |
|
|
|
2368 |
|
|
$group = new Form_Group('');
|
2369 |
|
|
|
2370 |
|
|
$group->add(new Form_Input(
|
2371 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_key_info_statement_keyid',
|
2372 |
|
|
null,
|
2373 |
|
|
'text',
|
2374 |
|
|
$pconfig['adv_dhcp6_key_info_statement_keyid']
|
2375 |
ae4c4bac
|
Stephen Beaver
|
))->sethelp('KeyID');
|
2376 |
|
|
|
2377 |
|
|
$group->add(new Form_Input(
|
2378 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_key_info_statement_secret',
|
2379 |
|
|
null,
|
2380 |
|
|
'text',
|
2381 |
|
|
$pconfig['adv_dhcp6_key_info_statement_secret']
|
2382 |
ae4c4bac
|
Stephen Beaver
|
))->sethelp('Secret');
|
2383 |
|
|
|
2384 |
|
|
$group->add(new Form_Input(
|
2385 |
68933ba7
|
Stephen Beaver
|
'adv_dhcp6_key_info_statement_expire',
|
2386 |
|
|
null,
|
2387 |
|
|
'text',
|
2388 |
|
|
$pconfig['adv_dhcp6_key_info_statement_expire']
|
2389 |
ae4c4bac
|
Stephen Beaver
|
))->sethelp('Expire');
|
2390 |
|
|
|
2391 |
79a1a27f
|
NOYB
|
$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 |
ae4c4bac
|
Stephen Beaver
|
$section->add($group);
|
2394 |
|
|
|
2395 |
|
|
$form->add($section);
|
2396 |
|
|
|
2397 |
|
|
$section = new Form_Section('6RD Configuration');
|
2398 |
c0c25504
|
Stephen Beaver
|
$section->addClass('_6rd');
|
2399 |
ae4c4bac
|
Stephen Beaver
|
|
2400 |
|
|
$section->addInput(new Form_Input(
|
2401 |
68933ba7
|
Stephen Beaver
|
'prefix-6rd',
|
2402 |
|
|
'6RD Prefix',
|
2403 |
|
|
'text',
|
2404 |
|
|
$pconfig['prefix-6rd']
|
2405 |
eaa948d6
|
NOYB
|
))->sethelp('6RD IPv6 prefix assigned by the ISP. e.g. "2001:db8::/32"');
|
2406 |
ae4c4bac
|
Stephen Beaver
|
|
2407 |
|
|
$section->addInput(new Form_Input(
|
2408 |
68933ba7
|
Stephen Beaver
|
'gateway-6rd',
|
2409 |
|
|
'6RD Border relay',
|
2410 |
|
|
'text',
|
2411 |
|
|
$pconfig['gateway-6rd']
|
2412 |
eaa948d6
|
NOYB
|
))->sethelp('6RD IPv4 gateway address assigned by the ISP');
|
2413 |
ae4c4bac
|
Stephen Beaver
|
|
2414 |
|
|
$section->addInput(new Form_Select(
|
2415 |
68933ba7
|
Stephen Beaver
|
'prefix-6rd-v4plen',
|
2416 |
6bb806c6
|
Chris Buechler
|
'6RD IPv4 Prefix length',
|
2417 |
68933ba7
|
Stephen Beaver
|
$pconfig['prefix-6rd-v4plen'],
|
2418 |
|
|
array_combine(range(0, 32), range(0, 32))
|
2419 |
ab9b8aad
|
NOYB
|
))->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 |
ae4c4bac
|
Stephen Beaver
|
|
2421 |
|
|
$form->add($section);
|
2422 |
|
|
|
2423 |
|
|
// Track IPv6 ointerface section
|
2424 |
|
|
$section = new Form_Section('Track IPv6 Interface');
|
2425 |
3375f236
|
Stephen Beaver
|
$section->addClass('track6');
|
2426 |
ae4c4bac
|
Stephen Beaver
|
|
2427 |
|
|
function build_ipv6interface_list() {
|
2428 |
9abccff3
|
Stephen Beaver
|
global $config, $section;
|
2429 |
|
|
|
2430 |
68933ba7
|
Stephen Beaver
|
$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 |
ae4c4bac
|
Stephen Beaver
|
}
|
2463 |
c0948c6c
|
Renato Botelho
|
|
2464 |
ae4c4bac
|
Stephen Beaver
|
$section->addInput(new Form_Select(
|
2465 |
68933ba7
|
Stephen Beaver
|
'track6-interface',
|
2466 |
|
|
'IPv6 Interface',
|
2467 |
|
|
$pconfig['track6-interface'],
|
2468 |
|
|
build_ipv6interface_list()
|
2469 |
8fc18e14
|
NOYB
|
))->setHelp('Selects the dynamic IPv6 WAN interface to track for configuration.');
|
2470 |
c0948c6c
|
Renato Botelho
|
|
2471 |
ae4c4bac
|
Stephen Beaver
|
if ($pconfig['track6-prefix-id'] == "") {
|
2472 |
68933ba7
|
Stephen Beaver
|
$pconfig['track6-prefix-id'] = 0;
|
2473 |
ae4c4bac
|
Stephen Beaver
|
}
|
2474 |
3a906378
|
gnhb
|
|
2475 |
ae4c4bac
|
Stephen Beaver
|
$section->addInput(new Form_Input(
|
2476 |
1ee6d09a
|
Phil Davis
|
'track6-prefix-id--hex',
|
2477 |
68933ba7
|
Stephen Beaver
|
'IPv6 Prefix ID',
|
2478 |
|
|
'text',
|
2479 |
|
|
sprintf("%x", $pconfig['track6-prefix-id'])
|
2480 |
aeeda8b4
|
Stephen Beaver
|
))->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 |
a0509b13
|
Stephen Beaver
|
|
2482 |
aeeda8b4
|
Stephen Beaver
|
$section->addInput(new Form_Input(
|
2483 |
1ee6d09a
|
Phil Davis
|
'track6-prefix-id-max',
|
2484 |
68933ba7
|
Stephen Beaver
|
null,
|
2485 |
|
|
'hidden',
|
2486 |
|
|
0
|
2487 |
aeeda8b4
|
Stephen Beaver
|
));
|
2488 |
a9929d56
|
Stephen Beaver
|
|
2489 |
ae4c4bac
|
Stephen Beaver
|
$form->add($section);
|
2490 |
|
|
|
2491 |
|
|
/// PPP section
|
2492 |
|
|
|
2493 |
|
|
$section = new Form_Section('PPP Configuration');
|
2494 |
3375f236
|
Stephen Beaver
|
$section->addClass('ppp');
|
2495 |
ae4c4bac
|
Stephen Beaver
|
|
2496 |
|
|
$section->addInput(new Form_Select(
|
2497 |
68933ba7
|
Stephen Beaver
|
'country',
|
2498 |
|
|
'Country',
|
2499 |
|
|
$pconfig['country'],
|
2500 |
|
|
[]
|
2501 |
ae4c4bac
|
Stephen Beaver
|
));
|
2502 |
|
|
|
2503 |
|
|
$section->addInput(new Form_Select(
|
2504 |
68933ba7
|
Stephen Beaver
|
'provider_list',
|
2505 |
|
|
'Provider',
|
2506 |
|
|
$pconfig['provider_list'],
|
2507 |
|
|
[]
|
2508 |
ae4c4bac
|
Stephen Beaver
|
));
|
2509 |
|
|
|
2510 |
|
|
$section->addInput(new Form_Select(
|
2511 |
68933ba7
|
Stephen Beaver
|
'providerplan',
|
2512 |
|
|
'Plan',
|
2513 |
|
|
$pconfig['providerplan'],
|
2514 |
|
|
[]
|
2515 |
eaa948d6
|
NOYB
|
))->setHelp('Select to fill in service provider data.');
|
2516 |
ae4c4bac
|
Stephen Beaver
|
|
2517 |
|
|
$section->addInput(new Form_Input(
|
2518 |
68933ba7
|
Stephen Beaver
|
'ppp_username',
|
2519 |
|
|
'Username',
|
2520 |
|
|
'text',
|
2521 |
|
|
$pconfig['ppp_username']
|
2522 |
ae4c4bac
|
Stephen Beaver
|
));
|
2523 |
|
|
|
2524 |
c8b10b4c
|
Stephen Beaver
|
$section->addPassword(new Form_Input(
|
2525 |
68933ba7
|
Stephen Beaver
|
'ppp_password',
|
2526 |
|
|
'Password',
|
2527 |
|
|
'password',
|
2528 |
|
|
$pconfig['ppp_password']
|
2529 |
ae4c4bac
|
Stephen Beaver
|
));
|
2530 |
|
|
|
2531 |
309e8f8f
|
Stephen Beaver
|
$section->addInput(new Form_Input(
|
2532 |
68933ba7
|
Stephen Beaver
|
'phone',
|
2533 |
|
|
'Phone number',
|
2534 |
|
|
'text',
|
2535 |
|
|
$pconfig['phone']
|
2536 |
8fc18e14
|
NOYB
|
))->setHelp('Typically *99# for GSM networks and #777 for CDMA networks.');
|
2537 |
986fd3d9
|
Renato Botelho
|
|
2538 |
ae4c4bac
|
Stephen Beaver
|
$section->addInput(new Form_Input(
|
2539 |
68933ba7
|
Stephen Beaver
|
'apn',
|
2540 |
|
|
'Access Point Name',
|
2541 |
|
|
'text',
|
2542 |
|
|
$pconfig['apn']
|
2543 |
ae4c4bac
|
Stephen Beaver
|
));
|
2544 |
|
|
|
2545 |
309e8f8f
|
Stephen Beaver
|
|
2546 |
ae4c4bac
|
Stephen Beaver
|
function build_port_list() {
|
2547 |
68933ba7
|
Stephen Beaver
|
$list = array("" => "None");
|
2548 |
a0509b13
|
Stephen Beaver
|
|
2549 |
68933ba7
|
Stephen Beaver
|
$portlist = glob("/dev/cua*");
|
2550 |
|
|
$modems = glob("/dev/modem*");
|
2551 |
|
|
$portlist = array_merge($portlist, $modems);
|
2552 |
ae4c4bac
|
Stephen Beaver
|
|
2553 |
68933ba7
|
Stephen Beaver
|
foreach ($portlist as $port) {
|
2554 |
|
|
if (preg_match("/\.(lock|init)$/", $port)) {
|
2555 |
|
|
continue;
|
2556 |
|
|
}
|
2557 |
ae4c4bac
|
Stephen Beaver
|
|
2558 |
68933ba7
|
Stephen Beaver
|
$list[trim($port)] = $port;
|
2559 |
|
|
}
|
2560 |
a0509b13
|
Stephen Beaver
|
|
2561 |
68933ba7
|
Stephen Beaver
|
return($list);
|
2562 |
a0509b13
|
Stephen Beaver
|
}
|
2563 |
309e8f8f
|
Stephen Beaver
|
|
2564 |
ae4c4bac
|
Stephen Beaver
|
$section->addInput(new Form_Select(
|
2565 |
68933ba7
|
Stephen Beaver
|
'port',
|
2566 |
|
|
"Modem port",
|
2567 |
|
|
$pconfig['port'],
|
2568 |
|
|
build_port_list()
|
2569 |
ae4c4bac
|
Stephen Beaver
|
));
|
2570 |
a0509b13
|
Stephen Beaver
|
|
2571 |
309e8f8f
|
Stephen Beaver
|
$section->addInput(new Form_Button(
|
2572 |
68933ba7
|
Stephen Beaver
|
'btnadvppp',
|
2573 |
faab522f
|
Renato Botelho
|
'Advanced PPP',
|
2574 |
827a3812
|
jim-p
|
isset($pconfig['pppid']) ? 'interfaces_ppps_edit.php?id=' . htmlspecialchars($pconfig['pppid']) : 'interfaces_ppps_edit.php',
|
2575 |
|
|
'fa-cog'
|
2576 |
8fc18e14
|
NOYB
|
))->setAttribute('type','button')->addClass('btn-info')->setAttribute('id')->setHelp('Create a new PPP configuration.');
|
2577 |
a0509b13
|
Stephen Beaver
|
|
2578 |
ae4c4bac
|
Stephen Beaver
|
$form->add($section);
|
2579 |
|
|
|
2580 |
|
|
// PPPoE configuration
|
2581 |
|
|
$section = new Form_Section('PPPoE Configuration');
|
2582 |
3375f236
|
Stephen Beaver
|
$section->addClass('pppoe');
|
2583 |
ae4c4bac
|
Stephen Beaver
|
|
2584 |
|
|
$section->addInput(new Form_Input(
|
2585 |
68933ba7
|
Stephen Beaver
|
'pppoe_username',
|
2586 |
|
|
'Username',
|
2587 |
|
|
'text',
|
2588 |
|
|
$pconfig['pppoe_username']
|
2589 |
ae4c4bac
|
Stephen Beaver
|
));
|
2590 |
|
|
|
2591 |
c8b10b4c
|
Stephen Beaver
|
$section->addPassword(new Form_Input(
|
2592 |
68933ba7
|
Stephen Beaver
|
'pppoe_password',
|
2593 |
|
|
'Password',
|
2594 |
|
|
'password',
|
2595 |
|
|
$pconfig['pppoe_password']
|
2596 |
ae4c4bac
|
Stephen Beaver
|
));
|
2597 |
|
|
|
2598 |
|
|
$section->addInput(new Form_Input(
|
2599 |
68933ba7
|
Stephen Beaver
|
'provider',
|
2600 |
|
|
'Service name',
|
2601 |
|
|
'text',
|
2602 |
|
|
$pconfig['provider']
|
2603 |
8fc18e14
|
NOYB
|
))->setHelp('This field can usually be left empty.');
|
2604 |
ae4c4bac
|
Stephen Beaver
|
|
2605 |
|
|
$section->addInput(new Form_Checkbox(
|
2606 |
68933ba7
|
Stephen Beaver
|
'pppoe_dialondemand',
|
2607 |
|
|
'Dial on demand',
|
2608 |
|
|
'Enable Dial-On-Demand mode ',
|
2609 |
|
|
$pconfig['pppoe_dialondemand'],
|
2610 |
|
|
'enable'
|
2611 |
ae4c4bac
|
Stephen Beaver
|
));
|
2612 |
|
|
|
2613 |
|
|
$section->addInput(new Form_Input(
|
2614 |
68933ba7
|
Stephen Beaver
|
'pppoe_idletimeout',
|
2615 |
|
|
'Idle timeout',
|
2616 |
|
|
'number',
|
2617 |
|
|
$pconfig['pppoe_idletimeout'],
|
2618 |
d07ae60c
|
BBcan177
|
['min' => 0]
|
2619 |
ae4c4bac
|
Stephen Beaver
|
))->setHelp('If no qualifying outgoing packets are transmitted for the specified number of seconds, the connection is brought down. ' .
|
2620 |
68933ba7
|
Stephen Beaver
|
'An idle timeout of zero disables this feature.');
|
2621 |
ae4c4bac
|
Stephen Beaver
|
|
2622 |
eaf7cb2a
|
Stephen Beaver
|
$section->addInput(new Form_Select(
|
2623 |
68933ba7
|
Stephen Beaver
|
'pppoe-reset-type',
|
2624 |
|
|
'Periodic reset',
|
2625 |
|
|
$pconfig['pppoe-reset-type'],
|
2626 |
6e8892c5
|
Stephen Beaver
|
['' => gettext('Disabled'), 'custom' => gettext('Custom'), 'preset' => gettext('Pre-set')]
|
2627 |
8fc18e14
|
NOYB
|
))->setHelp('Select a reset timing type.');
|
2628 |
eaf7cb2a
|
Stephen Beaver
|
|
2629 |
635f649d
|
Stephen Beaver
|
$group = new Form_Group('Custom reset');
|
2630 |
aeeda8b4
|
Stephen Beaver
|
$group->addClass('pppoecustom');
|
2631 |
eaf7cb2a
|
Stephen Beaver
|
|
2632 |
|
|
$group->add(new Form_Input(
|
2633 |
68933ba7
|
Stephen Beaver
|
'pppoe_resethour',
|
2634 |
|
|
null,
|
2635 |
|
|
'number',
|
2636 |
|
|
$pconfig['pppoe_resethour'],
|
2637 |
d07ae60c
|
BBcan177
|
['min' => 0, 'max' => 23]
|
2638 |
eaf7cb2a
|
Stephen Beaver
|
))->setHelp('Hour (0-23)');
|
2639 |
|
|
|
2640 |
|
|
$group->add(new Form_Input(
|
2641 |
68933ba7
|
Stephen Beaver
|
'pppoe_resetminute',
|
2642 |
|
|
null,
|
2643 |
|
|
'number',
|
2644 |
|
|
$pconfig['pppoe_resetminute'],
|
2645 |
d07ae60c
|
BBcan177
|
['min' => 0, 'max' => 59]
|
2646 |
eaf7cb2a
|
Stephen Beaver
|
))->setHelp('Minutes (0-59)');
|
2647 |
|
|
|
2648 |
|
|
$group->add(new Form_Input(
|
2649 |
68933ba7
|
Stephen Beaver
|
'pppoe_resetdate',
|
2650 |
|
|
null,
|
2651 |
|
|
'text',
|
2652 |
|
|
$pconfig['pppoe_resetdate']
|
2653 |
eaf7cb2a
|
Stephen Beaver
|
))->setHelp('Specific date (mm/dd/yyyy)');
|
2654 |
|
|
|
2655 |
eaa948d6
|
NOYB
|
$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 |
eaf7cb2a
|
Stephen Beaver
|
|
2657 |
|
|
$section->add($group);
|
2658 |
|
|
|
2659 |
|
|
$group = new Form_MultiCheckboxGroup('cron based reset');
|
2660 |
aeeda8b4
|
Stephen Beaver
|
$group->addClass('pppoepreset');
|
2661 |
eaf7cb2a
|
Stephen Beaver
|
|
2662 |
|
|
$group->add(new Form_MultiCheckbox(
|
2663 |
68933ba7
|
Stephen Beaver
|
'pppoe_pr_preset_val',
|
2664 |
|
|
null,
|
2665 |
|
|
'Reset at each month ("0 0 1 * *")',
|
2666 |
|
|
$pconfig['pppoe_monthly'],
|
2667 |
|
|
'monthly'
|
2668 |
eaf7cb2a
|
Stephen Beaver
|
))->displayAsRadio();
|
2669 |
|
|
|
2670 |
|
|
$group->add(new Form_MultiCheckbox(
|
2671 |
68933ba7
|
Stephen Beaver
|
'pppoe_pr_preset_val',
|
2672 |
|
|
null,
|
2673 |
|
|
'Reset at each week ("0 0 * * 0")',
|
2674 |
|
|
$pconfig['pppoe_weekly'],
|
2675 |
|
|
'weekly'
|
2676 |
eaf7cb2a
|
Stephen Beaver
|
))->displayAsRadio();
|
2677 |
|
|
|
2678 |
|
|
$group->add(new Form_MultiCheckbox(
|
2679 |
68933ba7
|
Stephen Beaver
|
'pppoe_pr_preset_val',
|
2680 |
|
|
null,
|
2681 |
|
|
'Reset at each day ("0 0 * * *")',
|
2682 |
|
|
$pconfig['pppoe_daily'],
|
2683 |
|
|
'daily'
|
2684 |
eaf7cb2a
|
Stephen Beaver
|
))->displayAsRadio();
|
2685 |
|
|
|
2686 |
|
|
$group->add(new Form_MultiCheckbox(
|
2687 |
68933ba7
|
Stephen Beaver
|
'pppoe_pr_preset_val',
|
2688 |
|
|
null,
|
2689 |
|
|
'Reset at each hour ("0 * * * *")',
|
2690 |
|
|
$pconfig['pppoe_hourly'],
|
2691 |
|
|
'hourly'
|
2692 |
eaf7cb2a
|
Stephen Beaver
|
))->displayAsRadio();
|
2693 |
|
|
|
2694 |
|
|
$section->add($group);
|
2695 |
|
|
|
2696 |
827a3812
|
jim-p
|
$section->addInput(new Form_Button(
|
2697 |
|
|
'btnadvppp',
|
2698 |
faab522f
|
Renato Botelho
|
'Advanced and MLPPP',
|
2699 |
827a3812
|
jim-p
|
isset($pconfig['pppid']) ? 'interfaces_ppps_edit.php?id=' . htmlspecialchars($pconfig['pppid']) : 'interfaces_ppps_edit.php',
|
2700 |
|
|
'fa-cog'
|
2701 |
347c0214
|
Phil Davis
|
))->setAttribute('type','button')->addClass('btn-info')->setAttribute('id')->setHelp('Click for additional PPPoE configuration options. Save first if changes have been made.');
|
2702 |
eaf7cb2a
|
Stephen Beaver
|
|
2703 |
|
|
$form->add($section);
|
2704 |
|
|
|
2705 |
|
|
// PPTP & L2TP Configuration section
|
2706 |
aeeda8b4
|
Stephen Beaver
|
$section = new Form_Section('PPTP/L2TP Configuration');
|
2707 |
3375f236
|
Stephen Beaver
|
$section->addClass('pptp');
|
2708 |
eaf7cb2a
|
Stephen Beaver
|
|
2709 |
|
|
$section->addInput(new Form_Input(
|
2710 |
68933ba7
|
Stephen Beaver
|
'pptp_username',
|
2711 |
|
|
'Username',
|
2712 |
|
|
'text',
|
2713 |
|
|
$pconfig['pptp_username']
|
2714 |
eaf7cb2a
|
Stephen Beaver
|
));
|
2715 |
|
|
|
2716 |
c8b10b4c
|
Stephen Beaver
|
$section->addPassword(new Form_Input(
|
2717 |
68933ba7
|
Stephen Beaver
|
'pptp_password',
|
2718 |
|
|
'Password',
|
2719 |
|
|
'password',
|
2720 |
|
|
$pconfig['pptp_password']
|
2721 |
eaf7cb2a
|
Stephen Beaver
|
));
|
2722 |
|
|
|
2723 |
|
|
$section->addInput(new Form_IpAddress(
|
2724 |
66fd7b47
|
Phil Davis
|
'pptp_local0',
|
2725 |
68933ba7
|
Stephen Beaver
|
'Local IP address',
|
2726 |
66fd7b47
|
Phil Davis
|
$pconfig['pptp_localip'][0]
|
2727 |
|
|
))->addMask('pptp_subnet0', $pconfig['pptp_subnet'][0]);
|
2728 |
eaf7cb2a
|
Stephen Beaver
|
|
2729 |
|
|
$section->addInput(new Form_IpAddress(
|
2730 |
66fd7b47
|
Phil Davis
|
'pptp_remote0',
|
2731 |
68933ba7
|
Stephen Beaver
|
'Remote IP address',
|
2732 |
|
|
$pconfig['pptp_remote'][0]
|
2733 |
eaf7cb2a
|
Stephen Beaver
|
));
|
2734 |
|
|
|
2735 |
|
|
$section->addInput(new Form_Checkbox(
|
2736 |
68933ba7
|
Stephen Beaver
|
'pptp_dialondemand',
|
2737 |
|
|
'Dial on demand',
|
2738 |
|
|
'Enable Dial-On-Demand mode ',
|
2739 |
|
|
$pconfig['pptp_dialondemand'],
|
2740 |
|
|
'enable'
|
2741 |
eaa948d6
|
NOYB
|
))->setHelp('This option causes the interface to operate in dial-on-demand mode, allowing it to be a virtual full time connection. ' .
|
2742 |
68933ba7
|
Stephen Beaver
|
'The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected.');
|
2743 |
eaf7cb2a
|
Stephen Beaver
|
|
2744 |
|
|
$section->addInput(new Form_Input(
|
2745 |
68933ba7
|
Stephen Beaver
|
'pptp_idletimeout',
|
2746 |
|
|
'Idle timeout (seconds)',
|
2747 |
|
|
'number',
|
2748 |
|
|
$pconfig['pptp_idletimeout'],
|
2749 |
d07ae60c
|
BBcan177
|
['min' => 0]
|
2750 |
eaf7cb2a
|
Stephen Beaver
|
))->setHelp('If no qualifying outgoing packets are transmitted for the specified number of seconds, the connection is brought down. ' .
|
2751 |
68933ba7
|
Stephen Beaver
|
'An idle timeout of zero disables this feature.');
|
2752 |
a0509b13
|
Stephen Beaver
|
|
2753 |
827a3812
|
jim-p
|
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 |
eaf7cb2a
|
Stephen Beaver
|
} else {
|
2756 |
827a3812
|
jim-p
|
$mlppp_text = "";
|
2757 |
eaf7cb2a
|
Stephen Beaver
|
}
|
2758 |
|
|
|
2759 |
827a3812
|
jim-p
|
$section->addInput(new Form_Button(
|
2760 |
|
|
'btnadvppp',
|
2761 |
faab522f
|
Renato Botelho
|
'Advanced and MLPPP',
|
2762 |
827a3812
|
jim-p
|
isset($pconfig['pppid']) ? 'interfaces_ppps_edit.php?id=' . htmlspecialchars($pconfig['pppid']) : 'interfaces_ppps_edit.php',
|
2763 |
|
|
'fa-cog'
|
2764 |
347c0214
|
Phil Davis
|
))->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 |
827a3812
|
jim-p
|
|
2766 |
ae4c4bac
|
Stephen Beaver
|
$form->add($section);
|
2767 |
eaf7cb2a
|
Stephen Beaver
|
|
2768 |
|
|
// Wireless interface
|
2769 |
a0509b13
|
Stephen Beaver
|
if (isset($wancfg['wireless'])) {
|
2770 |
|
|
|
2771 |
5f88f964
|
k-paulius
|
$section = new Form_Section('Common Wireless Configuration - Settings apply to all wireless networks on ' . $wlanbaseif . '.');
|
2772 |
68933ba7
|
Stephen Beaver
|
|
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 |
aa82505e
|
Phil Davis
|
if (count($mode_list) == 1) {
|
2790 |
68933ba7
|
Stephen Beaver
|
$mode_list[''] = '';
|
2791 |
aa82505e
|
Phil Davis
|
}
|
2792 |
68933ba7
|
Stephen Beaver
|
|
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 |
0fc3de67
|
Phil Davis
|
['off' => gettext('Off'), 'cts' => gettext('CTS to self'), 'rtscts' => gettext('RTS and CTS')]
|
2806 |
68933ba7
|
Stephen Beaver
|
))->setHelp('For IEEE 802.11g, use the specified technique for protecting OFDM frames in a mixed 11b/11g network.');
|
2807 |
aa82505e
|
Phil Davis
|
} else {
|
2808 |
68933ba7
|
Stephen Beaver
|
$section->addInput(new Form_Input(
|
2809 |
|
|
'protmode',
|
2810 |
|
|
null,
|
2811 |
|
|
'hidden',
|
2812 |
|
|
'off'
|
2813 |
|
|
));
|
2814 |
|
|
}
|
2815 |
|
|
|
2816 |
0fc3de67
|
Phil Davis
|
$mode_list = ['0' => gettext('Auto')];
|
2817 |
68933ba7
|
Stephen Beaver
|
|
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 |
eaa948d6
|
NOYB
|
'Not all channels may be supported by some cards. Auto may override the wireless standard selected above.');
|
2845 |
68933ba7
|
Stephen Beaver
|
|
2846 |
725f987f
|
Stephen Beaver
|
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 |
0fc3de67
|
Phil Davis
|
['' => gettext('Default'), '0' => gettext('Off'), '1' => gettext('On')]
|
2856 |
725f987f
|
Stephen Beaver
|
))->setHelp('Diversity');
|
2857 |
|
|
}
|
2858 |
68933ba7
|
Stephen Beaver
|
|
2859 |
725f987f
|
Stephen Beaver
|
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 |
0fc3de67
|
Phil Davis
|
['' => gettext('Default'), '0' => gettext('Auto'), '1' => gettext('#1'), '2' => gettext('#2')]
|
2865 |
725f987f
|
Stephen Beaver
|
))->setHelp('Transmit antenna');
|
2866 |
|
|
}
|
2867 |
68933ba7
|
Stephen Beaver
|
|
2868 |
725f987f
|
Stephen Beaver
|
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 |
0fc3de67
|
Phil Davis
|
['' => gettext('Default'), '0' => gettext('Auto'), '1' => gettext('#1'), '2' => gettext('#2')]
|
2874 |
725f987f
|
Stephen Beaver
|
))->setHelp('Receive antenna');
|
2875 |
|
|
}
|
2876 |
68933ba7
|
Stephen Beaver
|
|
2877 |
725f987f
|
Stephen Beaver
|
$group->setHelp('Note: The antenna numbers do not always match up with the labels on the card.');
|
2878 |
68933ba7
|
Stephen Beaver
|
|
2879 |
725f987f
|
Stephen Beaver
|
$section->add($group);
|
2880 |
|
|
}
|
2881 |
68933ba7
|
Stephen Beaver
|
}
|
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 |
5f88f964
|
k-paulius
|
$section = new Form_Section('Regulatory Settings');
|
2896 |
68933ba7
|
Stephen Beaver
|
|
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 |
0fc3de67
|
Phil Davis
|
['' => gettext('Default'), 'indoor' => gettext('Indoor'), 'outdoor' => gettext('Outdoor'), 'anywhere' => gettext('Anywhere')]
|
2932 |
68933ba7
|
Stephen Beaver
|
))->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 |
5f88f964
|
k-paulius
|
$section = new Form_Section('Network-Specific Wireless Configuration');
|
2941 |
68933ba7
|
Stephen Beaver
|
|
2942 |
|
|
$section->addInput(new Form_Select(
|
2943 |
|
|
'mode',
|
2944 |
|
|
'Mode',
|
2945 |
|
|
$pconfig['mode'],
|
2946 |
0fc3de67
|
Phil Davis
|
['bss' => gettext('Infrastructure (BSS)'), 'adhoc' => gettext('Ad-hoc (IBSS)'), 'hostap' => gettext('Access Point')]
|
2947 |
68933ba7
|
Stephen Beaver
|
));
|
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 |
0fc3de67
|
Phil Davis
|
['any' => gettext('Any'), '11g' => gettext('802.11g'), '11n' => gettext('802.11n')]
|
2962 |
68933ba7
|
Stephen Beaver
|
))->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 |
109ebe80
|
Stephen Beaver
|
null,
|
2968 |
68933ba7
|
Stephen Beaver
|
$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 |
11439ca3
|
jim-p
|
))->setHelp('Provides extra security by isolating clients so they cannot directly communicate with one another');
|
2980 |
68933ba7
|
Stephen Beaver
|
|
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 |
11439ca3
|
jim-p
|
'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 |
68933ba7
|
Stephen Beaver
|
$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 |
0fc3de67
|
Phil Davis
|
['1' => gettext('WPA'), '2' => gettext('WPA2'), '3' => gettext('Both')]
|
3022 |
68933ba7
|
Stephen Beaver
|
));
|
3023 |
|
|
|
3024 |
|
|
$section->addInput(new Form_Select(
|
3025 |
|
|
'wpa_key_mgmt',
|
3026 |
|
|
'WPA Key Management Mode',
|
3027 |
|
|
$pconfig['wpa_key_mgmt'],
|
3028 |
0fc3de67
|
Phil Davis
|
['WPA-PSK' => gettext('Pre-Shared Key'), 'WPA-EAP' => gettext('Extensible Authentication Protocol'), 'WPA-PSK WPA-EAP' => gettext('Both')]
|
3029 |
68933ba7
|
Stephen Beaver
|
));
|
3030 |
|
|
|
3031 |
|
|
$section->addInput(new Form_Select(
|
3032 |
|
|
'wpa_pairwise',
|
3033 |
|
|
'WPA Pairwise',
|
3034 |
|
|
(isset($pconfig['wpa_pairwise'])) ? $pconfig['wpa_pairwise']:'CCMP',
|
3035 |
0fc3de67
|
Phil Davis
|
['CCMP TKIP' => gettext('Both'), 'CCMP' => gettext('AES (recommended)'), 'TKIP' => gettext('TKIP')]
|
3036 |
68933ba7
|
Stephen Beaver
|
));
|
3037 |
|
|
|
3038 |
|
|
$section->addInput(new Form_Input(
|
3039 |
|
|
'wpa_group_rekey',
|
3040 |
11439ca3
|
jim-p
|
'Group Key Rotation',
|
3041 |
68933ba7
|
Stephen Beaver
|
'number',
|
3042 |
|
|
$pconfig['wpa_group_rekey'] ? $pconfig['wpa_group_rekey'] : "60",
|
3043 |
|
|
['min' => '1', 'max' => 9999]
|
3044 |
11439ca3
|
jim-p
|
))->setHelp('Time between group rekey events, specified in seconds. Allowed values are 1-9999. Must be shorter than Master Key Regeneration time');
|
3045 |
68933ba7
|
Stephen Beaver
|
|
3046 |
|
|
$section->addInput(new Form_Input(
|
3047 |
|
|
'wpa_gmk_rekey',
|
3048 |
11439ca3
|
jim-p
|
'Group Master Key Regeneration',
|
3049 |
68933ba7
|
Stephen Beaver
|
'number',
|
3050 |
|
|
$pconfig['wpa_gmk_rekey'] ? $pconfig['wpa_gmk_rekey'] : "3600",
|
3051 |
|
|
['min' => '1', 'max' => 9999]
|
3052 |
11439ca3
|
jim-p
|
))->setHelp('Time between GMK rekey events, specified in seconds. Allowed values are 1-9999. Must be longer than Group Key Rotation time');
|
3053 |
68933ba7
|
Stephen Beaver
|
|
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 |
d65e45d3
|
Stephen Beaver
|
$form->add($section);
|
3063 |
|
|
|
3064 |
5f88f964
|
k-paulius
|
$section = new Form_Section('802.1x RADIUS Options');
|
3065 |
d65e45d3
|
Stephen Beaver
|
|
3066 |
68933ba7
|
Stephen Beaver
|
$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 |
11439ca3
|
jim-p
|
))->setHelp('IP address of the RADIUS server');
|
3081 |
68933ba7
|
Stephen Beaver
|
|
3082 |
|
|
$group->add(new Form_Input(
|
3083 |
|
|
'auth_server_port',
|
3084 |
|
|
'Port',
|
3085 |
|
|
'number',
|
3086 |
|
|
$pconfig['auth_server_port']
|
3087 |
11439ca3
|
jim-p
|
))->setHelp('Server auth port. Default is 1812');
|
3088 |
68933ba7
|
Stephen Beaver
|
|
3089 |
|
|
$group->add(new Form_Input(
|
3090 |
|
|
'auth_server_shared_secret',
|
3091 |
11439ca3
|
jim-p
|
'Shared Secret',
|
3092 |
3f8cea5e
|
jim-p
|
'text',
|
3093 |
68933ba7
|
Stephen Beaver
|
$pconfig['auth_server_shared_secret']
|
3094 |
11439ca3
|
jim-p
|
))->setHelp('RADIUS Shared secret for this firewall');
|
3095 |
68933ba7
|
Stephen Beaver
|
|
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 |
11439ca3
|
jim-p
|
))->setHelp('IP address of the RADIUS server');
|
3105 |
68933ba7
|
Stephen Beaver
|
|
3106 |
|
|
$group->add(new Form_Input(
|
3107 |
|
|
'auth_server_port2',
|
3108 |
|
|
'Port',
|
3109 |
|
|
'number',
|
3110 |
|
|
$pconfig['auth_server_port2']
|
3111 |
11439ca3
|
jim-p
|
))->setHelp('Server auth port. Default is 1812');
|
3112 |
68933ba7
|
Stephen Beaver
|
|
3113 |
|
|
$group->add(new Form_Input(
|
3114 |
|
|
'auth_server_shared_secret2',
|
3115 |
11439ca3
|
jim-p
|
'Shared Secret',
|
3116 |
3f8cea5e
|
jim-p
|
'text',
|
3117 |
68933ba7
|
Stephen Beaver
|
$pconfig['auth_server_shared_secret2']
|
3118 |
11439ca3
|
jim-p
|
))->setHelp('RADIUS Shared secret for this firewall');
|
3119 |
68933ba7
|
Stephen Beaver
|
|
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 |
a0509b13
|
Stephen Beaver
|
}
|
3132 |
|
|
|
3133 |
3cf65ce0
|
NOYB
|
$section = new Form_Section('Reserved Networks');
|
3134 |
a0509b13
|
Stephen Beaver
|
|
3135 |
|
|
$section->addInput(new Form_Checkbox(
|
3136 |
68933ba7
|
Stephen Beaver
|
'blockpriv',
|
3137 |
eaa948d6
|
NOYB
|
'Block private networks and loopback addresses',
|
3138 |
68933ba7
|
Stephen Beaver
|
'',
|
3139 |
|
|
$pconfig['blockpriv'],
|
3140 |
|
|
'yes'
|
3141 |
a0509b13
|
Stephen Beaver
|
))->setHelp('Blocks traffic from IP addresses that are reserved for private networks per RFC 1918 (10/8, 172.16/12, 192.168/16) ' .
|
3142 |
eaa948d6
|
NOYB
|
'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 |
68933ba7
|
Stephen Beaver
|
|
3145 |
aa82505e
|
Phil Davis
|
$section->addInput(new Form_Checkbox(
|
3146 |
68933ba7
|
Stephen Beaver
|
'blockbogons',
|
3147 |
|
|
'Block bogon networks',
|
3148 |
|
|
'',
|
3149 |
|
|
$pconfig['blockbogons'],
|
3150 |
|
|
'yes'
|
3151 |
a0509b13
|
Stephen Beaver
|
))->setHelp('Blocks traffic from reserved IP addresses (but not RFC 1918) or not yet assigned by IANA. Bogons are prefixes that should ' .
|
3152 |
eaa948d6
|
NOYB
|
'never appear in the Internet routing table, and so should not appear as the source address in any packets received.' . '<br />' .
|
3153 |
f7586fed
|
NOYB
|
'Note: The update frequency can be changed under System->Advanced Firewall/NAT settings.');
|
3154 |
eaf7cb2a
|
Stephen Beaver
|
|
3155 |
|
|
$form->add($section);
|
3156 |
a0509b13
|
Stephen Beaver
|
|
3157 |
|
|
$form->addGlobal(new Form_Input(
|
3158 |
68933ba7
|
Stephen Beaver
|
'if',
|
3159 |
|
|
null,
|
3160 |
|
|
'hidden',
|
3161 |
|
|
$if
|
3162 |
a0509b13
|
Stephen Beaver
|
));
|
3163 |
|
|
|
3164 |
|
|
if ($wancfg['if'] == $a_ppps[$pppid]['if']) {
|
3165 |
68933ba7
|
Stephen Beaver
|
$form->addGlobal(new Form_Input(
|
3166 |
|
|
'ppp_port',
|
3167 |
|
|
null,
|
3168 |
|
|
'hidden',
|
3169 |
|
|
$pconfig['port']
|
3170 |
|
|
));
|
3171 |
eaf7cb2a
|
Stephen Beaver
|
}
|
3172 |
|
|
|
3173 |
a0509b13
|
Stephen Beaver
|
$form->addGlobal(new Form_Input(
|
3174 |
68933ba7
|
Stephen Beaver
|
'ptpid',
|
3175 |
|
|
null,
|
3176 |
|
|
'hidden',
|
3177 |
|
|
$pconfig['ptpid']
|
3178 |
a0509b13
|
Stephen Beaver
|
));
|
3179 |
|
|
|
3180 |
564599fa
|
Stephen Beaver
|
|
3181 |
|
|
// Add new gateway modal pop-up
|
3182 |
5f88f964
|
k-paulius
|
$modal = new Modal('New Gateway', 'newgateway', 'large');
|
3183 |
564599fa
|
Stephen Beaver
|
|
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 |
faab522f
|
Renato Botelho
|
'Add',
|
3213 |
2e7fa7ca
|
jim-p
|
null,
|
3214 |
|
|
'fa-plus'
|
3215 |
564599fa
|
Stephen Beaver
|
);
|
3216 |
|
|
|
3217 |
347c0214
|
Phil Davis
|
$btnaddgw->setAttribute('type','button')->addClass('btn-success');
|
3218 |
564599fa
|
Stephen Beaver
|
|
3219 |
|
|
$btncnxgw = new Form_Button(
|
3220 |
|
|
'cnx',
|
3221 |
faab522f
|
Renato Botelho
|
'Cancel',
|
3222 |
2e7fa7ca
|
jim-p
|
null,
|
3223 |
|
|
'fa-undo'
|
3224 |
564599fa
|
Stephen Beaver
|
);
|
3225 |
|
|
|
3226 |
347c0214
|
Phil Davis
|
$btncnxgw->setAttribute('type','button')->addClass('btn-warning');
|
3227 |
564599fa
|
Stephen Beaver
|
|
3228 |
|
|
$modal->addInput(new Form_StaticText(
|
3229 |
|
|
null,
|
3230 |
|
|
$btnaddgw . $btncnxgw
|
3231 |
|
|
));
|
3232 |
|
|
|
3233 |
|
|
$form->add($modal);
|
3234 |
|
|
|
3235 |
ae4c4bac
|
Stephen Beaver
|
print($form);
|
3236 |
|
|
?>
|
3237 |
a0509b13
|
Stephen Beaver
|
|
3238 |
ae4c4bac
|
Stephen Beaver
|
<script type="text/javascript">
|
3239 |
309e8f8f
|
Stephen Beaver
|
//<![CDATA[
|
3240 |
aa82505e
|
Phil Davis
|
events.push(function() {
|
3241 |
68933ba7
|
Stephen Beaver
|
function updateType(t) {
|
3242 |
564599fa
|
Stephen Beaver
|
|
3243 |
68933ba7
|
Stephen Beaver
|
switch (t) {
|
3244 |
|
|
case "none": {
|
3245 |
34ab580d
|
Stephen Beaver
|
$('.dhcpadvanced, .staticv4, .dhcp, .pppoe, .pptp, .ppp').hide();
|
3246 |
68933ba7
|
Stephen Beaver
|
break;
|
3247 |
|
|
}
|
3248 |
|
|
case "staticv4": {
|
3249 |
2ed5fb61
|
Phil Davis
|
$('.dhcpadvanced, .none, .dhcp').hide();
|
3250 |
564599fa
|
Stephen Beaver
|
$('.pppoe, .pptp, .ppp').hide();
|
3251 |
68933ba7
|
Stephen Beaver
|
break;
|
3252 |
|
|
}
|
3253 |
|
|
case "dhcp": {
|
3254 |
564599fa
|
Stephen Beaver
|
$('.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 |
68933ba7
|
Stephen Beaver
|
break;
|
3259 |
|
|
}
|
3260 |
|
|
case "ppp": {
|
3261 |
34ab580d
|
Stephen Beaver
|
$('.dhcpadvanced, .none, .staticv4, .dhcp, .pptp, .pppoe').hide();
|
3262 |
68933ba7
|
Stephen Beaver
|
country_list();
|
3263 |
|
|
break;
|
3264 |
|
|
}
|
3265 |
|
|
case "pppoe": {
|
3266 |
34ab580d
|
Stephen Beaver
|
$('.dhcpadvanced, .none, .staticv4, .dhcp, .pptp, .ppp').hide();
|
3267 |
68933ba7
|
Stephen Beaver
|
break;
|
3268 |
|
|
}
|
3269 |
|
|
case "l2tp":
|
3270 |
|
|
case "pptp": {
|
3271 |
34ab580d
|
Stephen Beaver
|
$('.dhcpadvanced, .none, .staticv4, .dhcp, .pppoe, .ppp').hide();
|
3272 |
68933ba7
|
Stephen Beaver
|
$('.pptp').show();
|
3273 |
|
|
break;
|
3274 |
|
|
}
|
3275 |
|
|
}
|
3276 |
|
|
|
3277 |
|
|
if (t != "l2tp" && t != "pptp") {
|
3278 |
|
|
$('.'+t).show();
|
3279 |
|
|
}
|
3280 |
|
|
}
|
3281 |
|
|
|
3282 |
|
|
function updateTypeSix(t) {
|
3283 |
aa82505e
|
Phil Davis
|
if (!isNaN(t[0])) {
|
3284 |
68933ba7
|
Stephen Beaver
|
t = '_' + t;
|
3285 |
aa82505e
|
Phil Davis
|
}
|
3286 |
68933ba7
|
Stephen Beaver
|
|
3287 |
|
|
switch (t) {
|
3288 |
|
|
case "none": {
|
3289 |
c0c25504
|
Stephen Beaver
|
$('.dhcp6advanced, .staticv6, .dhcp6, ._6rd, ._6to4, .track6, .slaac').hide();
|
3290 |
68933ba7
|
Stephen Beaver
|
break;
|
3291 |
|
|
}
|
3292 |
|
|
case "staticv6": {
|
3293 |
c0c25504
|
Stephen Beaver
|
$('.dhcp6advanced, .none, .dhcp6, ._6rd, ._6to4, .track6, .slaac').hide();
|
3294 |
68933ba7
|
Stephen Beaver
|
break;
|
3295 |
|
|
}
|
3296 |
|
|
case "slaac": {
|
3297 |
c0c25504
|
Stephen Beaver
|
$('.dhcp6advanced, .none, .staticv6, ._6rd, ._6to4, .track6, .dhcp6').hide();
|
3298 |
68933ba7
|
Stephen Beaver
|
break;
|
3299 |
|
|
}
|
3300 |
|
|
case "dhcp6": {
|
3301 |
c0c25504
|
Stephen Beaver
|
$('.dhcp6advanced, .none, .staticv6, ._6rd, ._6to4, .track6, .slaac').hide();
|
3302 |
68933ba7
|
Stephen Beaver
|
break;
|
3303 |
|
|
}
|
3304 |
ea125f70
|
Chris Buechler
|
case "_6rd": {
|
3305 |
c0c25504
|
Stephen Beaver
|
$('.dhcp6advanced, .none, .dhcp6, .staticv6, ._6to4, .track6, .slaac').hide();
|
3306 |
68933ba7
|
Stephen Beaver
|
break;
|
3307 |
|
|
}
|
3308 |
|
|
case "_6to4": {
|
3309 |
c0c25504
|
Stephen Beaver
|
$('.dhcp6advanced, .none, .dhcp6, .staticv6, ._6rd, .track6, .slaac').hide();
|
3310 |
68933ba7
|
Stephen Beaver
|
break;
|
3311 |
|
|
}
|
3312 |
|
|
case "track6": {
|
3313 |
c0c25504
|
Stephen Beaver
|
$('.dhcp6advanced, .none, .dhcp6, .staticv6, ._6rd, ._6to4, .slaac').hide();
|
3314 |
68933ba7
|
Stephen Beaver
|
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 |
e4517c3c
|
jim-p
|
alert("The IPv4 gateway could not be created.");
|
3392 |
68933ba7
|
Stephen Beaver
|
}
|
3393 |
|
|
|
3394 |
|
|
$("#newgateway").modal('hide');
|
3395 |
|
|
}
|
3396 |
|
|
|
3397 |
aa82505e
|
Phil Davis
|
function addOption(selectbox, text, value) {
|
3398 |
68933ba7
|
Stephen Beaver
|
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 |
4dda3174
|
Stephen Beaver
|
name = $('#name6').val();
|
3409 |
|
|
var descr = $('#gatewaydescr6').val();
|
3410 |
|
|
gatewayip = $('#gatewayip6').val();
|
3411 |
68933ba7
|
Stephen Beaver
|
var defaultgw = '';
|
3412 |
4dda3174
|
Stephen Beaver
|
if ($('#defaultgw6').is(':checked')) {
|
3413 |
68933ba7
|
Stephen Beaver
|
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 |
aa82505e
|
Phil Davis
|
function addOption_v6(selectbox, text, value) {
|
3429 |
68933ba7
|
Stephen Beaver
|
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 |
e4517c3c
|
jim-p
|
alert("The IPv6 gateway could not be created.");
|
3441 |
68933ba7
|
Stephen Beaver
|
}
|
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 |
7361f6c2
|
Stephen Beaver
|
var adv = $('#adv_dhcp6_config_advanced').prop('checked');
|
3553 |
68933ba7
|
Stephen Beaver
|
|
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 |
34ab580d
|
Stephen Beaver
|
function setDHCPoptions() {
|
3564 |
0c5916ce
|
NOYB
|
var adv = $('#adv_dhcp_config_advanced').prop('checked');
|
3565 |
|
|
var ovr = $('#adv_dhcp_config_file_override').prop('checked');
|
3566 |
34ab580d
|
Stephen Beaver
|
|
3567 |
aa82505e
|
Phil Davis
|
if (ovr) {
|
3568 |
34ab580d
|
Stephen Beaver
|
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 |
564599fa
|
Stephen Beaver
|
// 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 |
eef93144
|
Jared Dillard
|
// ---------- On initial page load ------------------------------------------------------------
|
3602 |
|
|
|
3603 |
68933ba7
|
Stephen Beaver
|
updateType($('#type').val());
|
3604 |
|
|
updateTypeSix($('#type6').val());
|
3605 |
|
|
show_reset_settings($('#pppoe-reset-type').val());
|
3606 |
|
|
hideClass('dhcp6advanced', true);
|
3607 |
34ab580d
|
Stephen Beaver
|
hideClass('dhcpadvanced', true);
|
3608 |
68933ba7
|
Stephen Beaver
|
show_dhcp6adv();
|
3609 |
34ab580d
|
Stephen Beaver
|
setDHCPoptions()
|
3610 |
68933ba7
|
Stephen Beaver
|
|
3611 |
564599fa
|
Stephen Beaver
|
// Set preset buttons on page load
|
3612 |
|
|
var sv = "<?=htmlspecialchars($pconfig['adv_dhcp_pt_values']);?>";
|
3613 |
aa82505e
|
Phil Davis
|
if (sv == "") {
|
3614 |
564599fa
|
Stephen Beaver
|
$("input[name=adv_dhcp_pt_values][value='SavedCfg']").prop('checked', true);
|
3615 |
b4f03056
|
NOYB
|
} else {
|
3616 |
|
|
$("input[name=adv_dhcp_pt_values][value="+sv+"]").prop('checked', true);
|
3617 |
aa82505e
|
Phil Davis
|
}
|
3618 |
564599fa
|
Stephen Beaver
|
|
3619 |
|
|
// Set preset from value
|
3620 |
|
|
setPresets(sv);
|
3621 |
aa82505e
|
Phil Davis
|
|
3622 |
eef93144
|
Jared Dillard
|
// ---------- Click checkbox handlers ---------------------------------------------------------
|
3623 |
9abccff3
|
Stephen Beaver
|
|
3624 |
564599fa
|
Stephen Beaver
|
$('#type').on('change', function() {
|
3625 |
aa82505e
|
Phil Davis
|
updateType(this.value);
|
3626 |
68933ba7
|
Stephen Beaver
|
});
|
3627 |
3375f236
|
Stephen Beaver
|
|
3628 |
34ab580d
|
Stephen Beaver
|
$('#type6').on('change', function() {
|
3629 |
aa82505e
|
Phil Davis
|
updateTypeSix(this.value);
|
3630 |
68933ba7
|
Stephen Beaver
|
});
|
3631 |
3375f236
|
Stephen Beaver
|
|
3632 |
1ee6d09a
|
Phil Davis
|
$('#track6-interface').on('change', function() {
|
3633 |
|
|
update_track6_prefix();
|
3634 |
|
|
});
|
3635 |
|
|
|
3636 |
34ab580d
|
Stephen Beaver
|
$('#pppoe-reset-type').on('change', function() {
|
3637 |
aa82505e
|
Phil Davis
|
show_reset_settings(this.value);
|
3638 |
68933ba7
|
Stephen Beaver
|
});
|
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 |
0c5916ce
|
NOYB
|
$('#adv_dhcp_config_advanced, #adv_dhcp_config_file_override').click(function () {
|
3669 |
34ab580d
|
Stephen Beaver
|
setDHCPoptions();
|
3670 |
|
|
});
|
3671 |
|
|
|
3672 |
7361f6c2
|
Stephen Beaver
|
$('#adv_dhcp6_config_advanced').click(function () {
|
3673 |
68933ba7
|
Stephen Beaver
|
show_dhcp6adv();
|
3674 |
|
|
});
|
3675 |
|
|
|
3676 |
|
|
$('#adv_dhcp6_config_file_override').click(function () {
|
3677 |
|
|
show_dhcp6adv();
|
3678 |
|
|
});
|
3679 |
|
|
|
3680 |
|
|
// On click . .
|
3681 |
b4f03056
|
NOYB
|
$('[name=adv_dhcp_pt_values]').click(function () {
|
3682 |
68933ba7
|
Stephen Beaver
|
setPresets($('input[name=adv_dhcp_pt_values]:checked').val());
|
3683 |
|
|
});
|
3684 |
564599fa
|
Stephen Beaver
|
|
3685 |
df38ab93
|
Stephen Beaver
|
$('#pppoe_resetdate').datepicker();
|
3686 |
|
|
|
3687 |
aeeda8b4
|
Stephen Beaver
|
});
|
3688 |
|
|
//]]>
|
3689 |
|
|
</script>
|
3690 |
ae4c4bac
|
Stephen Beaver
|
|
3691 |
241111d7
|
Stephen Beaver
|
<?php include("foot.inc");
|