Revision 68933ba7
Added by Stephen Beaver almost 10 years ago
src/usr/local/www/interfaces.php | ||
---|---|---|
1 | 1 |
<?php |
2 | 2 |
/* $Id$ */ |
3 | 3 |
/* |
4 |
interfaces.php
|
|
4 |
interfaces.php
|
|
5 | 5 |
*/ |
6 | 6 |
/* ==================================================================== |
7 |
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
|
|
8 |
* Copyright (c) 2004-2008 Scott Ullrich
|
|
9 |
* Copyright (c) 2006 Daniel S. Haischt
|
|
10 |
* Copyright (c) 2008-2010 Ermal Luçi
|
|
7 |
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
|
|
8 |
* Copyright (c) 2004-2008 Scott Ullrich
|
|
9 |
* Copyright (c) 2006 Daniel S. Haischt
|
|
10 |
* Copyright (c) 2008-2010 Ermal Luçi
|
|
11 | 11 |
* |
12 |
* Redistribution and use in source and binary forms, with or without modification,
|
|
13 |
* are permitted provided that the following conditions are met:
|
|
12 |
* Redistribution and use in source and binary forms, with or without modification,
|
|
13 |
* are permitted provided that the following conditions are met:
|
|
14 | 14 |
* |
15 |
* 1. Redistributions of source code must retain the above copyright notice,
|
|
16 |
* this list of conditions and the following disclaimer.
|
|
15 |
* 1. Redistributions of source code must retain the above copyright notice,
|
|
16 |
* this list of conditions and the following disclaimer.
|
|
17 | 17 |
* |
18 |
* 2. Redistributions in binary form must reproduce the above copyright
|
|
19 |
* notice, this list of conditions and the following disclaimer in
|
|
20 |
* the documentation and/or other materials provided with the
|
|
21 |
* distribution.
|
|
18 |
* 2. Redistributions in binary form must reproduce the above copyright
|
|
19 |
* notice, this list of conditions and the following disclaimer in
|
|
20 |
* the documentation and/or other materials provided with the
|
|
21 |
* distribution.
|
|
22 | 22 |
* |
23 |
* 3. All advertising materials mentioning features or use of this software
|
|
24 |
* must display the following acknowledgment:
|
|
25 |
* "This product includes software developed by the pfSense Project
|
|
26 |
* for use in the pfSense software distribution. (http://www.pfsense.org/).
|
|
23 |
* 3. All advertising materials mentioning features or use of this software
|
|
24 |
* must display the following acknowledgment:
|
|
25 |
* "This product includes software developed by the pfSense Project
|
|
26 |
* for use in the pfSense software distribution. (http://www.pfsense.org/).
|
|
27 | 27 |
* |
28 |
* 4. The names "pfSense" and "pfSense Project" must not be used to
|
|
29 |
* endorse or promote products derived from this software without
|
|
30 |
* prior written permission. For written permission, please contact
|
|
31 |
* coreteam@pfsense.org.
|
|
28 |
* 4. The names "pfSense" and "pfSense Project" must not be used to
|
|
29 |
* endorse or promote products derived from this software without
|
|
30 |
* prior written permission. For written permission, please contact
|
|
31 |
* coreteam@pfsense.org.
|
|
32 | 32 |
* |
33 |
* 5. Products derived from this software may not be called "pfSense"
|
|
34 |
* nor may "pfSense" appear in their names without prior written
|
|
35 |
* permission of the Electric Sheep Fencing, LLC.
|
|
33 |
* 5. Products derived from this software may not be called "pfSense"
|
|
34 |
* nor may "pfSense" appear in their names without prior written
|
|
35 |
* permission of the Electric Sheep Fencing, LLC.
|
|
36 | 36 |
* |
37 |
* 6. Redistributions of any form whatsoever must retain the following
|
|
38 |
* acknowledgment:
|
|
37 |
* 6. Redistributions of any form whatsoever must retain the following
|
|
38 |
* acknowledgment:
|
|
39 | 39 |
* |
40 |
* "This product includes software developed by the pfSense Project
|
|
41 |
* for use in the pfSense software distribution (http://www.pfsense.org/).
|
|
40 |
* "This product includes software developed by the pfSense Project
|
|
41 |
* for use in the pfSense software distribution (http://www.pfsense.org/).
|
|
42 | 42 |
* |
43 |
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
|
|
44 |
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
45 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
46 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
|
|
47 |
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
48 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
49 |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
50 |
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
51 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
52 |
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
53 |
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
54 |
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
43 |
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
|
|
44 |
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
45 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
46 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
|
|
47 |
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
48 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
49 |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
50 |
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
51 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
52 |
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
53 |
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
54 |
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
55 | 55 |
* |
56 |
* ====================================================================
|
|
56 |
* ====================================================================
|
|
57 | 57 |
* |
58 | 58 |
*/ |
59 | 59 |
/* |
60 |
pfSense_BUILDER_BINARIES: /usr/sbin/arp
|
|
61 |
pfSense_MODULE: interfaces
|
|
60 |
pfSense_BUILDER_BINARIES: /usr/sbin/arp
|
|
61 |
pfSense_MODULE: interfaces
|
|
62 | 62 |
*/ |
63 | 63 |
|
64 | 64 |
##|+PRIV |
... | ... | |
81 | 81 |
define("ALLOWWEP", false); |
82 | 82 |
|
83 | 83 |
if (isset($_POST['referer'])) { |
84 |
$referer = $_POST['referer'];
|
|
84 |
$referer = $_POST['referer'];
|
|
85 | 85 |
} else { |
86 |
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/interfaces.php');
|
|
86 |
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/interfaces.php');
|
|
87 | 87 |
} |
88 | 88 |
|
89 | 89 |
// Get configured interface list |
... | ... | |
91 | 91 |
|
92 | 92 |
$if = "wan"; |
93 | 93 |
if ($_REQUEST['if']) { |
94 |
$if = $_REQUEST['if'];
|
|
94 |
$if = $_REQUEST['if'];
|
|
95 | 95 |
} |
96 | 96 |
|
97 | 97 |
if (empty($ifdescrs[$if])) { |
98 |
header("Location: interfaces.php");
|
|
99 |
exit;
|
|
98 |
header("Location: interfaces.php");
|
|
99 |
exit;
|
|
100 | 100 |
} |
101 | 101 |
|
102 | 102 |
define("CRON_MONTHLY_PATTERN", "0 0 1 * *"); |
... | ... | |
105 | 105 |
define("CRON_HOURLY_PATTERN", "0 * * * *"); |
106 | 106 |
|
107 | 107 |
if (!is_array($pconfig)) { |
108 |
$pconfig = array();
|
|
108 |
$pconfig = array();
|
|
109 | 109 |
} |
110 | 110 |
|
111 | 111 |
if (!is_array($config['ppps'])) { |
112 |
$config['ppps'] = array();
|
|
112 |
$config['ppps'] = array();
|
|
113 | 113 |
} |
114 | 114 |
if (!is_array($config['ppps']['ppp'])) { |
115 |
$config['ppps']['ppp'] = array();
|
|
115 |
$config['ppps']['ppp'] = array();
|
|
116 | 116 |
} |
117 | 117 |
$a_ppps = &$config['ppps']['ppp']; |
118 | 118 |
|
119 | 119 |
function remove_bad_chars($string) { |
120 |
return preg_replace('/[^a-z_0-9]/i', '', $string);
|
|
120 |
return preg_replace('/[^a-z_0-9]/i', '', $string);
|
|
121 | 121 |
} |
122 | 122 |
|
123 | 123 |
if (!is_array($config['gateways']['gateway_item'])) { |
124 |
$config['gateways']['gateway_item'] = array();
|
|
124 |
$config['gateways']['gateway_item'] = array();
|
|
125 | 125 |
} |
126 | 126 |
$a_gateways = &$config['gateways']['gateway_item']; |
127 | 127 |
|
... | ... | |
131 | 131 |
$old_ppps = $a_ppps; |
132 | 132 |
// Populate page descr if it does not exist. |
133 | 133 |
if ($if == "wan" && !$wancfg['descr']) { |
134 |
$wancfg['descr'] = "WAN";
|
|
134 |
$wancfg['descr'] = "WAN";
|
|
135 | 135 |
} else if ($if == "lan" && !$wancfg['descr']) { |
136 |
$wancfg['descr'] = "LAN";
|
|
136 |
$wancfg['descr'] = "LAN";
|
|
137 | 137 |
} |
138 | 138 |
|
139 | 139 |
/* NOTE: The code here is used to set the $pppid for the curious */ |
140 | 140 |
foreach ($a_ppps as $pppid => $ppp) { |
141 |
if ($wancfg['if'] == $ppp['if']) {
|
|
142 |
break;
|
|
143 |
}
|
|
141 |
if ($wancfg['if'] == $ppp['if']) {
|
|
142 |
break;
|
|
143 |
}
|
|
144 | 144 |
} |
145 | 145 |
|
146 | 146 |
$type_disabled = (substr($wancfg['if'], 0, 3) == 'gre') ? 'disabled="disabled"' : ''; |
147 | 147 |
|
148 | 148 |
if ($wancfg['if'] == $a_ppps[$pppid]['if']) { |
149 |
$pconfig['pppid'] = $pppid;
|
|
150 |
$pconfig['ptpid'] = $a_ppps[$pppid]['ptpid'];
|
|
151 |
$pconfig['port'] = $a_ppps[$pppid]['ports'];
|
|
152 |
if ($a_ppps[$pppid]['type'] == "ppp") {
|
|
153 |
$pconfig['ppp_username'] = $a_ppps[$pppid]['username'];
|
|
154 |
$pconfig['ppp_password'] = base64_decode($a_ppps[$pppid]['password']);
|
|
155 |
|
|
156 |
$pconfig['phone'] = $a_ppps[$pppid]['phone'];
|
|
157 |
$pconfig['apn'] = $a_ppps[$pppid]['apn'];
|
|
158 |
} else if ($a_ppps[$pppid]['type'] == "pppoe") {
|
|
159 |
$pconfig['pppoe_username'] = $a_ppps[$pppid]['username'];
|
|
160 |
$pconfig['pppoe_password'] = base64_decode($a_ppps[$pppid]['password']);
|
|
161 |
$pconfig['provider'] = $a_ppps[$pppid]['provider'];
|
|
162 |
$pconfig['pppoe_dialondemand'] = isset($a_ppps[$pppid]['ondemand']);
|
|
163 |
$pconfig['pppoe_idletimeout'] = $a_ppps[$pppid]['idletimeout'];
|
|
164 |
|
|
165 |
/* ================================================ */
|
|
166 |
/* = force a connection reset at a specific time? = */
|
|
167 |
/* ================================================ */
|
|
168 |
|
|
169 |
if (isset($a_ppps[$pppid]['pppoe-reset-type'])) {
|
|
170 |
$pconfig['pppoe-reset-type'] = $a_ppps[$pppid]['pppoe-reset-type'];
|
|
171 |
$itemhash = getMPDCRONSettings($a_ppps[$pppid]['if']);
|
|
172 |
if ($itemhash) {
|
|
173 |
$cronitem = $itemhash['ITEM'];
|
|
174 |
}
|
|
175 |
if (isset($cronitem)) {
|
|
176 |
$resetTime = "{$cronitem['minute']} {$cronitem['hour']} {$cronitem['mday']} {$cronitem['month']} {$cronitem['wday']}";
|
|
177 |
} else {
|
|
178 |
$resetTime = NULL;
|
|
179 |
}
|
|
180 |
//log_error("ResetTime:".$resetTime);
|
|
181 |
if ($a_ppps[$pppid]['pppoe-reset-type'] == "custom") {
|
|
182 |
if ($cronitem) {
|
|
183 |
$pconfig['pppoe_pr_custom'] = true;
|
|
184 |
$pconfig['pppoe_resetminute'] = $cronitem['minute'];
|
|
185 |
$pconfig['pppoe_resethour'] = $cronitem['hour'];
|
|
186 |
if ($cronitem['mday'] != "*" && $cronitem['month'] != "*") {
|
|
187 |
$pconfig['pppoe_resetdate'] = "{$cronitem['month']}/{$cronitem['mday']}/" . date("Y");
|
|
188 |
}
|
|
189 |
}
|
|
190 |
} else if ($a_ppps[$pppid]['pppoe-reset-type'] == "preset") {
|
|
191 |
$pconfig['pppoe_pr_preset'] = true;
|
|
192 |
switch ($resetTime) {
|
|
193 |
case CRON_MONTHLY_PATTERN:
|
|
194 |
$pconfig['pppoe_monthly'] = true;
|
|
195 |
break;
|
|
196 |
case CRON_WEEKLY_PATTERN:
|
|
197 |
$pconfig['pppoe_weekly'] = true;
|
|
198 |
break;
|
|
199 |
case CRON_DAILY_PATTERN:
|
|
200 |
$pconfig['pppoe_daily'] = true;
|
|
201 |
break;
|
|
202 |
case CRON_HOURLY_PATTERN:
|
|
203 |
$pconfig['pppoe_hourly'] = true;
|
|
204 |
break;
|
|
205 |
}
|
|
206 |
}
|
|
207 |
} // End force pppoe reset at specific time
|
|
208 |
// End if type == pppoe
|
|
209 |
} else if ($a_ppps[$pppid]['type'] == "pptp" || $a_ppps[$pppid]['type'] == "l2tp") {
|
|
210 |
$pconfig['pptp_username'] = $a_ppps[$pppid]['username'];
|
|
211 |
$pconfig['pptp_password'] = base64_decode($a_ppps[$pppid]['password']);
|
|
212 |
$pconfig['pptp_local'] = explode(",", $a_ppps[$pppid]['localip']);
|
|
213 |
$pconfig['pptp_subnet'] = explode(",", $a_ppps[$pppid]['subnet']);
|
|
214 |
$pconfig['pptp_remote'] = explode(",", $a_ppps[$pppid]['gateway']);
|
|
215 |
$pconfig['pptp_dialondemand'] = isset($a_ppps[$pppid]['ondemand']);
|
|
216 |
$pconfig['pptp_idletimeout'] = $a_ppps[$pppid]['timeout'];
|
|
217 |
}
|
|
149 |
$pconfig['pppid'] = $pppid;
|
|
150 |
$pconfig['ptpid'] = $a_ppps[$pppid]['ptpid'];
|
|
151 |
$pconfig['port'] = $a_ppps[$pppid]['ports'];
|
|
152 |
if ($a_ppps[$pppid]['type'] == "ppp") {
|
|
153 |
$pconfig['ppp_username'] = $a_ppps[$pppid]['username'];
|
|
154 |
$pconfig['ppp_password'] = base64_decode($a_ppps[$pppid]['password']);
|
|
155 |
|
|
156 |
$pconfig['phone'] = $a_ppps[$pppid]['phone'];
|
|
157 |
$pconfig['apn'] = $a_ppps[$pppid]['apn'];
|
|
158 |
} else if ($a_ppps[$pppid]['type'] == "pppoe") {
|
|
159 |
$pconfig['pppoe_username'] = $a_ppps[$pppid]['username'];
|
|
160 |
$pconfig['pppoe_password'] = base64_decode($a_ppps[$pppid]['password']);
|
|
161 |
$pconfig['provider'] = $a_ppps[$pppid]['provider'];
|
|
162 |
$pconfig['pppoe_dialondemand'] = isset($a_ppps[$pppid]['ondemand']);
|
|
163 |
$pconfig['pppoe_idletimeout'] = $a_ppps[$pppid]['idletimeout'];
|
|
164 |
|
|
165 |
/* ================================================ */
|
|
166 |
/* = force a connection reset at a specific time? = */
|
|
167 |
/* ================================================ */
|
|
168 |
|
|
169 |
if (isset($a_ppps[$pppid]['pppoe-reset-type'])) {
|
|
170 |
$pconfig['pppoe-reset-type'] = $a_ppps[$pppid]['pppoe-reset-type'];
|
|
171 |
$itemhash = getMPDCRONSettings($a_ppps[$pppid]['if']);
|
|
172 |
if ($itemhash) {
|
|
173 |
$cronitem = $itemhash['ITEM'];
|
|
174 |
}
|
|
175 |
if (isset($cronitem)) {
|
|
176 |
$resetTime = "{$cronitem['minute']} {$cronitem['hour']} {$cronitem['mday']} {$cronitem['month']} {$cronitem['wday']}";
|
|
177 |
} else {
|
|
178 |
$resetTime = NULL;
|
|
179 |
}
|
|
180 |
//log_error("ResetTime:".$resetTime);
|
|
181 |
if ($a_ppps[$pppid]['pppoe-reset-type'] == "custom") {
|
|
182 |
if ($cronitem) {
|
|
183 |
$pconfig['pppoe_pr_custom'] = true;
|
|
184 |
$pconfig['pppoe_resetminute'] = $cronitem['minute'];
|
|
185 |
$pconfig['pppoe_resethour'] = $cronitem['hour'];
|
|
186 |
if ($cronitem['mday'] != "*" && $cronitem['month'] != "*") {
|
|
187 |
$pconfig['pppoe_resetdate'] = "{$cronitem['month']}/{$cronitem['mday']}/" . date("Y");
|
|
188 |
}
|
|
189 |
}
|
|
190 |
} else if ($a_ppps[$pppid]['pppoe-reset-type'] == "preset") {
|
|
191 |
$pconfig['pppoe_pr_preset'] = true;
|
|
192 |
switch ($resetTime) {
|
|
193 |
case CRON_MONTHLY_PATTERN:
|
|
194 |
$pconfig['pppoe_monthly'] = true;
|
|
195 |
break;
|
|
196 |
case CRON_WEEKLY_PATTERN:
|
|
197 |
$pconfig['pppoe_weekly'] = true;
|
|
198 |
break;
|
|
199 |
case CRON_DAILY_PATTERN:
|
|
200 |
$pconfig['pppoe_daily'] = true;
|
|
201 |
break;
|
|
202 |
case CRON_HOURLY_PATTERN:
|
|
203 |
$pconfig['pppoe_hourly'] = true;
|
|
204 |
break;
|
|
205 |
}
|
|
206 |
}
|
|
207 |
} // End force pppoe reset at specific time
|
|
208 |
// End if type == pppoe
|
|
209 |
} else if ($a_ppps[$pppid]['type'] == "pptp" || $a_ppps[$pppid]['type'] == "l2tp") {
|
|
210 |
$pconfig['pptp_username'] = $a_ppps[$pppid]['username'];
|
|
211 |
$pconfig['pptp_password'] = base64_decode($a_ppps[$pppid]['password']);
|
|
212 |
$pconfig['pptp_local'] = explode(",", $a_ppps[$pppid]['localip']);
|
|
213 |
$pconfig['pptp_subnet'] = explode(",", $a_ppps[$pppid]['subnet']);
|
|
214 |
$pconfig['pptp_remote'] = explode(",", $a_ppps[$pppid]['gateway']);
|
|
215 |
$pconfig['pptp_dialondemand'] = isset($a_ppps[$pppid]['ondemand']);
|
|
216 |
$pconfig['pptp_idletimeout'] = $a_ppps[$pppid]['timeout'];
|
|
217 |
}
|
|
218 | 218 |
} else { |
219 |
$pconfig['ptpid'] = interfaces_ptpid_next();
|
|
220 |
$pppid = count($a_ppps);
|
|
219 |
$pconfig['ptpid'] = interfaces_ptpid_next();
|
|
220 |
$pppid = count($a_ppps);
|
|
221 | 221 |
} |
222 | 222 |
$pconfig['dhcphostname'] = $wancfg['dhcphostname']; |
223 | 223 |
$pconfig['alias-address'] = $wancfg['alias-address']; |
... | ... | |
282 | 282 |
$pconfig['enable'] = isset($wancfg['enable']); |
283 | 283 |
|
284 | 284 |
if (is_array($config['aliases']['alias'])) { |
285 |
foreach ($config['aliases']['alias'] as $alias) {
|
|
286 |
if ($alias['name'] == $wancfg['descr']) {
|
|
287 |
$input_errors[] = sprintf(gettext("Sorry, an alias with the name %s already exists."), $wancfg['descr']);
|
|
288 |
}
|
|
289 |
}
|
|
285 |
foreach ($config['aliases']['alias'] as $alias) {
|
|
286 |
if ($alias['name'] == $wancfg['descr']) {
|
|
287 |
$input_errors[] = sprintf(gettext("Sorry, an alias with the name %s already exists."), $wancfg['descr']);
|
|
288 |
}
|
|
289 |
}
|
|
290 | 290 |
} |
291 | 291 |
|
292 | 292 |
switch ($wancfg['ipaddr']) { |
293 |
case "dhcp":
|
|
294 |
$pconfig['type'] = "dhcp";
|
|
295 |
break;
|
|
296 |
case "pppoe":
|
|
297 |
case "pptp":
|
|
298 |
case "l2tp":
|
|
299 |
case "ppp":
|
|
300 |
$pconfig['type'] = $wancfg['ipaddr'];
|
|
301 |
break;
|
|
302 |
default:
|
|
303 |
if (is_ipaddrv4($wancfg['ipaddr'])) {
|
|
304 |
$pconfig['type'] = "staticv4";
|
|
305 |
$pconfig['ipaddr'] = $wancfg['ipaddr'];
|
|
306 |
$pconfig['subnet'] = $wancfg['subnet'];
|
|
307 |
$pconfig['gateway'] = $wancfg['gateway'];
|
|
308 |
} else {
|
|
309 |
$pconfig['type'] = "none";
|
|
310 |
}
|
|
311 |
break;
|
|
293 |
case "dhcp":
|
|
294 |
$pconfig['type'] = "dhcp";
|
|
295 |
break;
|
|
296 |
case "pppoe":
|
|
297 |
case "pptp":
|
|
298 |
case "l2tp":
|
|
299 |
case "ppp":
|
|
300 |
$pconfig['type'] = $wancfg['ipaddr'];
|
|
301 |
break;
|
|
302 |
default:
|
|
303 |
if (is_ipaddrv4($wancfg['ipaddr'])) {
|
|
304 |
$pconfig['type'] = "staticv4";
|
|
305 |
$pconfig['ipaddr'] = $wancfg['ipaddr'];
|
|
306 |
$pconfig['subnet'] = $wancfg['subnet'];
|
|
307 |
$pconfig['gateway'] = $wancfg['gateway'];
|
|
308 |
} else {
|
|
309 |
$pconfig['type'] = "none";
|
|
310 |
}
|
|
311 |
break;
|
|
312 | 312 |
} |
313 | 313 |
|
314 | 314 |
switch ($wancfg['ipaddrv6']) { |
315 |
case "slaac":
|
|
316 |
$pconfig['type6'] = "slaac";
|
|
317 |
break;
|
|
318 |
case "dhcp6":
|
|
319 |
$pconfig['dhcp6-duid'] = $wancfg['dhcp6-duid'];
|
|
320 |
if (!isset($wancfg['dhcp6-ia-pd-len'])) {
|
|
321 |
$wancfg['dhcp6-ia-pd-len'] = "none";
|
|
322 |
}
|
|
323 |
$pconfig['dhcp6-ia-pd-len'] = $wancfg['dhcp6-ia-pd-len'];
|
|
324 |
$pconfig['dhcp6-ia-pd-send-hint'] = isset($wancfg['dhcp6-ia-pd-send-hint']);
|
|
325 |
$pconfig['type6'] = "dhcp6";
|
|
326 |
$pconfig['dhcp6prefixonly'] = isset($wancfg['dhcp6prefixonly']);
|
|
327 |
$pconfig['dhcp6usev4iface'] = isset($wancfg['dhcp6usev4iface']);
|
|
328 |
break;
|
|
329 |
case "6to4":
|
|
330 |
$pconfig['type6'] = "6to4";
|
|
331 |
break;
|
|
332 |
case "track6":
|
|
333 |
$pconfig['type6'] = "track6";
|
|
334 |
$pconfig['track6-interface'] = $wancfg['track6-interface'];
|
|
335 |
if ($wancfg['track6-prefix-id'] == "") {
|
|
336 |
$pconfig['track6-prefix-id'] = 0;
|
|
337 |
} else {
|
|
338 |
$pconfig['track6-prefix-id'] = $wancfg['track6-prefix-id'];
|
|
339 |
}
|
|
340 |
$pconfig['track6-prefix-id--hex'] = sprintf("%x", $pconfig['track6-prefix-id']);
|
|
341 |
break;
|
|
342 |
case "6rd":
|
|
343 |
$pconfig['prefix-6rd'] = $wancfg['prefix-6rd'];
|
|
344 |
if ($wancfg['prefix-6rd-v4plen'] == "") {
|
|
345 |
$wancfg['prefix-6rd-v4plen'] = "0";
|
|
346 |
}
|
|
347 |
$pconfig['prefix-6rd-v4plen'] = $wancfg['prefix-6rd-v4plen'];
|
|
348 |
$pconfig['type6'] = "6rd";
|
|
349 |
$pconfig['gateway-6rd'] = $wancfg['gateway-6rd'];
|
|
350 |
break;
|
|
351 |
default:
|
|
352 |
if (is_ipaddrv6($wancfg['ipaddrv6'])) {
|
|
353 |
$pconfig['type6'] = "staticv6";
|
|
354 |
$pconfig['ipaddrv6'] = $wancfg['ipaddrv6'];
|
|
355 |
$pconfig['subnetv6'] = $wancfg['subnetv6'];
|
|
356 |
$pconfig['gatewayv6'] = $wancfg['gatewayv6'];
|
|
357 |
} else {
|
|
358 |
$pconfig['type6'] = "none";
|
|
359 |
}
|
|
360 |
break;
|
|
315 |
case "slaac":
|
|
316 |
$pconfig['type6'] = "slaac";
|
|
317 |
break;
|
|
318 |
case "dhcp6":
|
|
319 |
$pconfig['dhcp6-duid'] = $wancfg['dhcp6-duid'];
|
|
320 |
if (!isset($wancfg['dhcp6-ia-pd-len'])) {
|
|
321 |
$wancfg['dhcp6-ia-pd-len'] = "none";
|
|
322 |
}
|
|
323 |
$pconfig['dhcp6-ia-pd-len'] = $wancfg['dhcp6-ia-pd-len'];
|
|
324 |
$pconfig['dhcp6-ia-pd-send-hint'] = isset($wancfg['dhcp6-ia-pd-send-hint']);
|
|
325 |
$pconfig['type6'] = "dhcp6";
|
|
326 |
$pconfig['dhcp6prefixonly'] = isset($wancfg['dhcp6prefixonly']);
|
|
327 |
$pconfig['dhcp6usev4iface'] = isset($wancfg['dhcp6usev4iface']);
|
|
328 |
break;
|
|
329 |
case "6to4":
|
|
330 |
$pconfig['type6'] = "6to4";
|
|
331 |
break;
|
|
332 |
case "track6":
|
|
333 |
$pconfig['type6'] = "track6";
|
|
334 |
$pconfig['track6-interface'] = $wancfg['track6-interface'];
|
|
335 |
if ($wancfg['track6-prefix-id'] == "") {
|
|
336 |
$pconfig['track6-prefix-id'] = 0;
|
|
337 |
} else {
|
|
338 |
$pconfig['track6-prefix-id'] = $wancfg['track6-prefix-id'];
|
|
339 |
}
|
|
340 |
$pconfig['track6-prefix-id--hex'] = sprintf("%x", $pconfig['track6-prefix-id']);
|
|
341 |
break;
|
|
342 |
case "6rd":
|
|
343 |
$pconfig['prefix-6rd'] = $wancfg['prefix-6rd'];
|
|
344 |
if ($wancfg['prefix-6rd-v4plen'] == "") {
|
|
345 |
$wancfg['prefix-6rd-v4plen'] = "0";
|
|
346 |
}
|
|
347 |
$pconfig['prefix-6rd-v4plen'] = $wancfg['prefix-6rd-v4plen'];
|
|
348 |
$pconfig['type6'] = "6rd";
|
|
349 |
$pconfig['gateway-6rd'] = $wancfg['gateway-6rd'];
|
|
350 |
break;
|
|
351 |
default:
|
|
352 |
if (is_ipaddrv6($wancfg['ipaddrv6'])) {
|
|
353 |
$pconfig['type6'] = "staticv6";
|
|
354 |
$pconfig['ipaddrv6'] = $wancfg['ipaddrv6'];
|
|
355 |
$pconfig['subnetv6'] = $wancfg['subnetv6'];
|
|
356 |
$pconfig['gatewayv6'] = $wancfg['gatewayv6'];
|
|
357 |
} else {
|
|
358 |
$pconfig['type6'] = "none";
|
|
359 |
}
|
|
360 |
break;
|
|
361 | 361 |
} |
362 | 362 |
|
363 | 363 |
// print_r($pconfig); |
... | ... | |
370 | 370 |
|
371 | 371 |
/* Wireless interface? */ |
372 | 372 |
if (isset($wancfg['wireless'])) { |
373 |
/* Sync first to be sure it displays the actual settings that will be used */
|
|
374 |
interface_sync_wireless_clones($wancfg, false);
|
|
375 |
/* Get wireless modes */
|
|
376 |
$wlanif = get_real_interface($if);
|
|
377 |
if (!does_interface_exist($wlanif)) {
|
|
378 |
interface_wireless_clone($wlanif, $wancfg);
|
|
379 |
}
|
|
380 |
$wlanbaseif = interface_get_wireless_base($wancfg['if']);
|
|
381 |
preg_match("/^(.*?)([0-9]*)$/", $wlanbaseif, $wlanbaseif_split);
|
|
382 |
$wl_modes = get_wireless_modes($if);
|
|
383 |
$wl_chaninfo = get_wireless_channel_info($if);
|
|
384 |
$wl_sysctl_prefix = 'dev.' . $wlanbaseif_split[1] . '.' . $wlanbaseif_split[2];
|
|
385 |
$wl_sysctl = get_sysctl(
|
|
386 |
array(
|
|
387 |
"{$wl_sysctl_prefix}.diversity",
|
|
388 |
"{$wl_sysctl_prefix}.txantenna",
|
|
389 |
"{$wl_sysctl_prefix}.rxantenna",
|
|
390 |
"{$wl_sysctl_prefix}.slottime",
|
|
391 |
"{$wl_sysctl_prefix}.acktimeout",
|
|
392 |
"{$wl_sysctl_prefix}.ctstimeout"));
|
|
393 |
$wl_regdomain_xml_attr = array();
|
|
394 |
$wl_regdomain_xml = parse_xml_regdomain($wl_regdomain_xml_attr);
|
|
395 |
$wl_regdomains = &$wl_regdomain_xml['regulatory-domains']['rd'];
|
|
396 |
$wl_regdomains_attr = &$wl_regdomain_xml_attr['regulatory-domains']['rd'];
|
|
397 |
$wl_countries = &$wl_regdomain_xml['country-codes']['country'];
|
|
398 |
$wl_countries_attr = &$wl_regdomain_xml_attr['country-codes']['country'];
|
|
399 |
$pconfig['persistcommonwireless'] = isset($config['wireless']['interfaces'][$wlanbaseif]);
|
|
400 |
$pconfig['standard'] = $wancfg['wireless']['standard'];
|
|
401 |
$pconfig['mode'] = $wancfg['wireless']['mode'];
|
|
402 |
$pconfig['protmode'] = $wancfg['wireless']['protmode'];
|
|
403 |
$pconfig['ssid'] = $wancfg['wireless']['ssid'];
|
|
404 |
$pconfig['channel'] = $wancfg['wireless']['channel'];
|
|
405 |
$pconfig['txpower'] = $wancfg['wireless']['txpower'];
|
|
406 |
$pconfig['diversity'] = $wancfg['wireless']['diversity'];
|
|
407 |
$pconfig['txantenna'] = $wancfg['wireless']['txantenna'];
|
|
408 |
$pconfig['rxantenna'] = $wancfg['wireless']['rxantenna'];
|
|
409 |
$pconfig['distance'] = $wancfg['wireless']['distance'];
|
|
410 |
$pconfig['regdomain'] = $wancfg['wireless']['regdomain'];
|
|
411 |
$pconfig['regcountry'] = $wancfg['wireless']['regcountry'];
|
|
412 |
$pconfig['reglocation'] = $wancfg['wireless']['reglocation'];
|
|
413 |
$pconfig['wme_enable'] = isset($wancfg['wireless']['wme']['enable']);
|
|
414 |
if (isset($wancfg['wireless']['puren']['enable'])) {
|
|
415 |
$pconfig['puremode'] = '11n';
|
|
416 |
} else if (isset($wancfg['wireless']['pureg']['enable'])) {
|
|
417 |
$pconfig['puremode'] = '11g';
|
|
418 |
} else {
|
|
419 |
$pconfig['puremode'] = 'any';
|
|
420 |
}
|
|
421 |
$pconfig['apbridge_enable'] = isset($wancfg['wireless']['apbridge']['enable']);
|
|
422 |
$pconfig['authmode'] = $wancfg['wireless']['authmode'];
|
|
423 |
$pconfig['hidessid_enable'] = isset($wancfg['wireless']['hidessid']['enable']);
|
|
424 |
$pconfig['auth_server_addr'] = $wancfg['wireless']['auth_server_addr'];
|
|
425 |
$pconfig['auth_server_port'] = $wancfg['wireless']['auth_server_port'];
|
|
426 |
$pconfig['auth_server_shared_secret'] = $wancfg['wireless']['auth_server_shared_secret'];
|
|
427 |
$pconfig['auth_server_addr2'] = $wancfg['wireless']['auth_server_addr2'];
|
|
428 |
$pconfig['auth_server_port2'] = $wancfg['wireless']['auth_server_port2'];
|
|
429 |
$pconfig['auth_server_shared_secret2'] = $wancfg['wireless']['auth_server_shared_secret2'];
|
|
430 |
if (is_array($wancfg['wireless']['wpa'])) {
|
|
431 |
$pconfig['debug_mode'] = $wancfg['wireless']['wpa']['debug_mode'];
|
|
432 |
$pconfig['macaddr_acl'] = $wancfg['wireless']['wpa']['macaddr_acl'];
|
|
433 |
$pconfig['mac_acl_enable'] = isset($wancfg['wireless']['wpa']['mac_acl_enable']);
|
|
434 |
$pconfig['auth_algs'] = $wancfg['wireless']['wpa']['auth_algs'];
|
|
435 |
$pconfig['wpa_mode'] = $wancfg['wireless']['wpa']['wpa_mode'];
|
|
436 |
$pconfig['wpa_key_mgmt'] = $wancfg['wireless']['wpa']['wpa_key_mgmt'];
|
|
437 |
$pconfig['wpa_pairwise'] = $wancfg['wireless']['wpa']['wpa_pairwise'];
|
|
438 |
$pconfig['wpa_group_rekey'] = $wancfg['wireless']['wpa']['wpa_group_rekey'];
|
|
439 |
$pconfig['wpa_gmk_rekey'] = $wancfg['wireless']['wpa']['wpa_gmk_rekey'];
|
|
440 |
$pconfig['wpa_strict_rekey'] = isset($wancfg['wireless']['wpa']['wpa_strict_rekey']);
|
|
441 |
$pconfig['passphrase'] = $wancfg['wireless']['wpa']['passphrase'];
|
|
442 |
$pconfig['ieee8021x'] = isset($wancfg['wireless']['wpa']['ieee8021x']['enable']);
|
|
443 |
$pconfig['rsn_preauth'] = isset($wancfg['wireless']['wpa']['rsn_preauth']);
|
|
444 |
$pconfig['ext_wpa_sw'] = $wancfg['wireless']['wpa']['ext_wpa_sw'];
|
|
445 |
$pconfig['wpa_enable'] = isset($wancfg['wireless']['wpa']['enable']);
|
|
446 |
}
|
|
447 |
|
|
448 |
$pconfig['mac_acl'] = $wancfg['wireless']['mac_acl'];
|
|
449 |
|
|
450 |
if(ALLOWWEP) {
|
|
451 |
$pconfig['wep_enable'] = isset($wancfg['wireless']['wep']['enable']);
|
|
452 |
|
|
453 |
if (is_array($wancfg['wireless']['wep']) && is_array($wancfg['wireless']['wep']['key'])) {
|
|
454 |
$i = 1;
|
|
455 |
foreach ($wancfg['wireless']['wep']['key'] as $wepkey) {
|
|
456 |
$pconfig['key' . $i] = $wepkey['value'];
|
|
457 |
if (isset($wepkey['txkey'])) {
|
|
458 |
$pconfig['txkey'] = $i;
|
|
459 |
}
|
|
460 |
$i++;
|
|
461 |
}
|
|
462 |
if (!isset($wepkey['txkey'])) {
|
|
463 |
$pconfig['txkey'] = 1;
|
|
464 |
}
|
|
465 |
}
|
|
466 |
}
|
|
373 |
/* Sync first to be sure it displays the actual settings that will be used */
|
|
374 |
interface_sync_wireless_clones($wancfg, false);
|
|
375 |
/* Get wireless modes */
|
|
376 |
$wlanif = get_real_interface($if);
|
|
377 |
if (!does_interface_exist($wlanif)) {
|
|
378 |
interface_wireless_clone($wlanif, $wancfg);
|
|
379 |
}
|
|
380 |
$wlanbaseif = interface_get_wireless_base($wancfg['if']);
|
|
381 |
preg_match("/^(.*?)([0-9]*)$/", $wlanbaseif, $wlanbaseif_split);
|
|
382 |
$wl_modes = get_wireless_modes($if);
|
|
383 |
$wl_chaninfo = get_wireless_channel_info($if);
|
|
384 |
$wl_sysctl_prefix = 'dev.' . $wlanbaseif_split[1] . '.' . $wlanbaseif_split[2];
|
|
385 |
$wl_sysctl = get_sysctl(
|
|
386 |
array(
|
|
387 |
"{$wl_sysctl_prefix}.diversity",
|
|
388 |
"{$wl_sysctl_prefix}.txantenna",
|
|
389 |
"{$wl_sysctl_prefix}.rxantenna",
|
|
390 |
"{$wl_sysctl_prefix}.slottime",
|
|
391 |
"{$wl_sysctl_prefix}.acktimeout",
|
|
392 |
"{$wl_sysctl_prefix}.ctstimeout"));
|
|
393 |
$wl_regdomain_xml_attr = array();
|
|
394 |
$wl_regdomain_xml = parse_xml_regdomain($wl_regdomain_xml_attr);
|
|
395 |
$wl_regdomains = &$wl_regdomain_xml['regulatory-domains']['rd'];
|
|
396 |
$wl_regdomains_attr = &$wl_regdomain_xml_attr['regulatory-domains']['rd'];
|
|
397 |
$wl_countries = &$wl_regdomain_xml['country-codes']['country'];
|
|
398 |
$wl_countries_attr = &$wl_regdomain_xml_attr['country-codes']['country'];
|
|
399 |
$pconfig['persistcommonwireless'] = isset($config['wireless']['interfaces'][$wlanbaseif]);
|
|
400 |
$pconfig['standard'] = $wancfg['wireless']['standard'];
|
|
401 |
$pconfig['mode'] = $wancfg['wireless']['mode'];
|
|
402 |
$pconfig['protmode'] = $wancfg['wireless']['protmode'];
|
|
403 |
$pconfig['ssid'] = $wancfg['wireless']['ssid'];
|
|
404 |
$pconfig['channel'] = $wancfg['wireless']['channel'];
|
|
405 |
$pconfig['txpower'] = $wancfg['wireless']['txpower'];
|
|
406 |
$pconfig['diversity'] = $wancfg['wireless']['diversity'];
|
|
407 |
$pconfig['txantenna'] = $wancfg['wireless']['txantenna'];
|
|
408 |
$pconfig['rxantenna'] = $wancfg['wireless']['rxantenna'];
|
|
409 |
$pconfig['distance'] = $wancfg['wireless']['distance'];
|
|
410 |
$pconfig['regdomain'] = $wancfg['wireless']['regdomain'];
|
|
411 |
$pconfig['regcountry'] = $wancfg['wireless']['regcountry'];
|
|
412 |
$pconfig['reglocation'] = $wancfg['wireless']['reglocation'];
|
|
413 |
$pconfig['wme_enable'] = isset($wancfg['wireless']['wme']['enable']);
|
|
414 |
if (isset($wancfg['wireless']['puren']['enable'])) {
|
|
415 |
$pconfig['puremode'] = '11n';
|
|
416 |
} else if (isset($wancfg['wireless']['pureg']['enable'])) {
|
|
417 |
$pconfig['puremode'] = '11g';
|
|
418 |
} else {
|
|
419 |
$pconfig['puremode'] = 'any';
|
|
420 |
}
|
|
421 |
$pconfig['apbridge_enable'] = isset($wancfg['wireless']['apbridge']['enable']);
|
|
422 |
$pconfig['authmode'] = $wancfg['wireless']['authmode'];
|
|
423 |
$pconfig['hidessid_enable'] = isset($wancfg['wireless']['hidessid']['enable']);
|
|
424 |
$pconfig['auth_server_addr'] = $wancfg['wireless']['auth_server_addr'];
|
|
425 |
$pconfig['auth_server_port'] = $wancfg['wireless']['auth_server_port'];
|
|
426 |
$pconfig['auth_server_shared_secret'] = $wancfg['wireless']['auth_server_shared_secret'];
|
|
427 |
$pconfig['auth_server_addr2'] = $wancfg['wireless']['auth_server_addr2'];
|
|
428 |
$pconfig['auth_server_port2'] = $wancfg['wireless']['auth_server_port2'];
|
|
429 |
$pconfig['auth_server_shared_secret2'] = $wancfg['wireless']['auth_server_shared_secret2'];
|
|
430 |
if (is_array($wancfg['wireless']['wpa'])) {
|
|
431 |
$pconfig['debug_mode'] = $wancfg['wireless']['wpa']['debug_mode'];
|
|
432 |
$pconfig['macaddr_acl'] = $wancfg['wireless']['wpa']['macaddr_acl'];
|
|
433 |
$pconfig['mac_acl_enable'] = isset($wancfg['wireless']['wpa']['mac_acl_enable']);
|
|
434 |
$pconfig['auth_algs'] = $wancfg['wireless']['wpa']['auth_algs'];
|
|
435 |
$pconfig['wpa_mode'] = $wancfg['wireless']['wpa']['wpa_mode'];
|
|
436 |
$pconfig['wpa_key_mgmt'] = $wancfg['wireless']['wpa']['wpa_key_mgmt'];
|
|
437 |
$pconfig['wpa_pairwise'] = $wancfg['wireless']['wpa']['wpa_pairwise'];
|
|
438 |
$pconfig['wpa_group_rekey'] = $wancfg['wireless']['wpa']['wpa_group_rekey'];
|
|
439 |
$pconfig['wpa_gmk_rekey'] = $wancfg['wireless']['wpa']['wpa_gmk_rekey'];
|
|
440 |
$pconfig['wpa_strict_rekey'] = isset($wancfg['wireless']['wpa']['wpa_strict_rekey']);
|
|
441 |
$pconfig['passphrase'] = $wancfg['wireless']['wpa']['passphrase'];
|
|
442 |
$pconfig['ieee8021x'] = isset($wancfg['wireless']['wpa']['ieee8021x']['enable']);
|
|
443 |
$pconfig['rsn_preauth'] = isset($wancfg['wireless']['wpa']['rsn_preauth']);
|
|
444 |
$pconfig['ext_wpa_sw'] = $wancfg['wireless']['wpa']['ext_wpa_sw'];
|
|
445 |
$pconfig['wpa_enable'] = isset($wancfg['wireless']['wpa']['enable']);
|
|
446 |
}
|
|
447 |
|
|
448 |
$pconfig['mac_acl'] = $wancfg['wireless']['mac_acl'];
|
|
449 |
|
|
450 |
if(ALLOWWEP) {
|
|
451 |
$pconfig['wep_enable'] = isset($wancfg['wireless']['wep']['enable']);
|
|
452 |
|
|
453 |
if (is_array($wancfg['wireless']['wep']) && is_array($wancfg['wireless']['wep']['key'])) {
|
|
454 |
$i = 1;
|
|
455 |
foreach ($wancfg['wireless']['wep']['key'] as $wepkey) {
|
|
456 |
$pconfig['key' . $i] = $wepkey['value'];
|
|
457 |
if (isset($wepkey['txkey'])) {
|
|
458 |
$pconfig['txkey'] = $i;
|
|
459 |
}
|
|
460 |
$i++;
|
|
461 |
}
|
|
462 |
if (!isset($wepkey['txkey'])) {
|
|
463 |
$pconfig['txkey'] = 1;
|
|
464 |
}
|
|
465 |
}
|
|
466 |
}
|
|
467 | 467 |
} |
468 | 468 |
|
469 | 469 |
if ($_POST['apply']) { |
470 |
unset($input_errors);
|
|
471 |
if (!is_subsystem_dirty('interfaces')) {
|
|
472 |
$input_errors[] = gettext("You have already applied your settings!");
|
|
473 |
} else {
|
|
474 |
unlink_if_exists("{$g['tmp_path']}/config.cache");
|
|
475 |
clear_subsystem_dirty('interfaces');
|
|
476 |
|
|
477 |
if (file_exists("{$g['tmp_path']}/.interfaces.apply")) {
|
|
478 |
$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.interfaces.apply"));
|
|
479 |
foreach ($toapplylist as $ifapply => $ifcfgo) {
|
|
480 |
if (isset($config['interfaces'][$ifapply]['enable'])) {
|
|
481 |
interface_bring_down($ifapply, false, $ifcfgo);
|
|
482 |
interface_configure($ifapply, true);
|
|
483 |
} else {
|
|
484 |
interface_bring_down($ifapply, true, $ifcfgo);
|
|
485 |
if (isset($config['dhcpd'][$ifapply]['enable']) ||
|
|
486 |
isset($config['dhcpdv6'][$ifapply]['enable'])) {
|
|
487 |
services_dhcpd_configure();
|
|
488 |
}
|
|
489 |
}
|
|
490 |
}
|
|
491 |
}
|
|
492 |
/* restart snmp so that it binds to correct address */
|
|
493 |
services_snmpd_configure();
|
|
494 |
|
|
495 |
/* sync filter configuration */
|
|
496 |
setup_gateways_monitor();
|
|
497 |
|
|
498 |
clear_subsystem_dirty('interfaces');
|
|
499 |
|
|
500 |
filter_configure();
|
|
501 |
|
|
502 |
enable_rrd_graphing();
|
|
503 |
|
|
504 |
if (is_subsystem_dirty('staticroutes') && (system_routing_configure() == 0)) {
|
|
505 |
clear_subsystem_dirty('staticroutes');
|
|
506 |
}
|
|
507 |
}
|
|
508 |
@unlink("{$g['tmp_path']}/.interfaces.apply");
|
|
509 |
header("Location: interfaces.php?if={$if}");
|
|
510 |
exit;
|
|
470 |
unset($input_errors);
|
|
471 |
if (!is_subsystem_dirty('interfaces')) {
|
|
472 |
$input_errors[] = gettext("You have already applied your settings!");
|
|
473 |
} else {
|
|
474 |
unlink_if_exists("{$g['tmp_path']}/config.cache");
|
|
475 |
clear_subsystem_dirty('interfaces');
|
|
476 |
|
|
477 |
if (file_exists("{$g['tmp_path']}/.interfaces.apply")) {
|
|
478 |
$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.interfaces.apply"));
|
|
479 |
foreach ($toapplylist as $ifapply => $ifcfgo) {
|
|
480 |
if (isset($config['interfaces'][$ifapply]['enable'])) {
|
|
481 |
interface_bring_down($ifapply, false, $ifcfgo);
|
|
482 |
interface_configure($ifapply, true);
|
|
483 |
} else {
|
|
484 |
interface_bring_down($ifapply, true, $ifcfgo);
|
|
485 |
if (isset($config['dhcpd'][$ifapply]['enable']) ||
|
|
486 |
isset($config['dhcpdv6'][$ifapply]['enable'])) {
|
|
487 |
services_dhcpd_configure();
|
|
488 |
}
|
|
489 |
}
|
|
490 |
}
|
|
491 |
}
|
|
492 |
/* restart snmp so that it binds to correct address */
|
|
493 |
services_snmpd_configure();
|
|
494 |
|
|
495 |
/* sync filter configuration */
|
|
496 |
setup_gateways_monitor();
|
|
497 |
|
|
498 |
clear_subsystem_dirty('interfaces');
|
|
499 |
|
|
500 |
filter_configure();
|
|
501 |
|
|
502 |
enable_rrd_graphing();
|
|
503 |
|
|
504 |
if (is_subsystem_dirty('staticroutes') && (system_routing_configure() == 0)) {
|
|
505 |
clear_subsystem_dirty('staticroutes');
|
|
506 |
}
|
|
507 |
}
|
|
508 |
@unlink("{$g['tmp_path']}/.interfaces.apply");
|
|
509 |
header("Location: interfaces.php?if={$if}");
|
|
510 |
exit;
|
|
511 | 511 |
} else if ($_POST && $_POST['enable'] != "yes") { |
512 |
unset($wancfg['enable']);
|
|
513 |
if (isset($wancfg['wireless'])) {
|
|
514 |
interface_sync_wireless_clones($wancfg, false);
|
|
515 |
}
|
|
516 |
write_config("Interface {$_POST['descr']}({$if}) is now disabled.");
|
|
517 |
mark_subsystem_dirty('interfaces');
|
|
518 |
if (file_exists("{$g['tmp_path']}/.interfaces.apply")) {
|
|
519 |
$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.interfaces.apply"));
|
|
520 |
} else {
|
|
521 |
$toapplylist = array();
|
|
522 |
}
|
|
523 |
$toapplylist[$if]['ifcfg'] = $wancfg;
|
|
524 |
$toapplylist[$if]['ppps'] = $a_ppps;
|
|
525 |
/* we need to be able remove IP aliases for IPv6 */
|
|
526 |
file_put_contents("{$g['tmp_path']}/.interfaces.apply", serialize($toapplylist));
|
|
527 |
header("Location: interfaces.php?if={$if}");
|
|
528 |
exit;
|
|
512 |
unset($wancfg['enable']);
|
|
513 |
if (isset($wancfg['wireless'])) {
|
|
514 |
interface_sync_wireless_clones($wancfg, false);
|
|
515 |
}
|
|
516 |
write_config("Interface {$_POST['descr']}({$if}) is now disabled.");
|
|
517 |
mark_subsystem_dirty('interfaces');
|
|
518 |
if (file_exists("{$g['tmp_path']}/.interfaces.apply")) {
|
|
519 |
$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.interfaces.apply"));
|
|
520 |
} else {
|
|
521 |
$toapplylist = array();
|
|
522 |
}
|
|
523 |
$toapplylist[$if]['ifcfg'] = $wancfg;
|
|
524 |
$toapplylist[$if]['ppps'] = $a_ppps;
|
|
525 |
/* we need to be able remove IP aliases for IPv6 */
|
|
526 |
file_put_contents("{$g['tmp_path']}/.interfaces.apply", serialize($toapplylist));
|
|
527 |
header("Location: interfaces.php?if={$if}");
|
|
528 |
exit;
|
|
529 | 529 |
} else if ($_POST) { |
530 | 530 |
|
531 |
unset($input_errors); |
|
532 |
$pconfig = $_POST; |
|
533 |
|
|
534 |
if (is_numeric("0x" . $_POST['track6-prefix-id--hex'])) { |
|
535 |
$pconfig['track6-prefix-id'] = intval($_POST['track6-prefix-id--hex'], 16); |
|
536 |
} else { |
|
537 |
$pconfig['track6-prefix-id'] = 0; |
|
538 |
} |
|
539 |
conf_mount_rw(); |
|
540 |
|
|
541 |
/* filter out spaces from descriptions */ |
|
542 |
$_POST['descr'] = remove_bad_chars($_POST['descr']); |
|
543 |
|
|
544 |
/* okay first of all, cause we are just hiding the PPPoE HTML |
|
545 |
* fields related to PPPoE resets, we are going to unset $_POST |
|
546 |
* vars, if the reset feature should not be used. Otherwise the |
|
547 |
* data validation procedure below, may trigger a false error |
|
548 |
* message. |
|
549 |
*/ |
|
550 |
if (empty($_POST['pppoe-reset-type'])) { |
|
551 |
unset($_POST['pppoe_pr_type']); |
|
552 |
unset($_POST['pppoe_resethour']); |
|
553 |
unset($_POST['pppoe_resetminute']); |
|
554 |
unset($_POST['pppoe_resetdate']); |
|
555 |
unset($_POST['pppoe_pr_preset_val']); |
|
556 |
} |
|
557 |
/* description unique? */ |
|
558 |
foreach ($ifdescrs as $ifent => $ifdescr) { |
|
559 |
if ($if != $ifent && $ifdescr == $_POST['descr']) { |
|
560 |
$input_errors[] = gettext("An interface with the specified description already exists."); |
|
561 |
break; |
|
562 |
} |
|
563 |
} |
|
564 |
if (is_numeric($_POST['descr'])) { |
|
565 |
$input_errors[] = gettext("The interface description cannot contain only numbers."); |
|
566 |
} |
|
567 |
/* input validation */ |
|
568 |
if (isset($config['dhcpd']) && isset($config['dhcpd'][$if]['enable']) && (!preg_match("/^staticv4/", $_POST['type']))) { |
|
569 |
$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."); |
|
570 |
} |
|
571 |
if (isset($config['dhcpdv6']) && isset($config['dhcpdv6'][$if]['enable']) && (!preg_match("/^staticv6/", $_POST['type6']))) { |
|
572 |
$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."); |
|
573 |
} |
|
574 |
|
|
575 |
switch (strtolower($_POST['type'])) { |
|
576 |
case "staticv4": |
|
577 |
$reqdfields = explode(" ", "ipaddr subnet gateway"); |
|
578 |
$reqdfieldsn = array(gettext("IPv4 address"), gettext("Subnet bit count"), gettext("Gateway")); |
|
579 |
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); |
|
580 |
break; |
|
581 |
case "none": |
|
582 |
if (is_array($config['virtualip']['vip'])) { |
|
583 |
foreach ($config['virtualip']['vip'] as $vip) { |
|
584 |
if (is_ipaddrv4($vip['subnet']) && $vip['interface'] == $if) { |
|
585 |
$input_errors[] = gettext("This interface is referenced by IPv4 VIPs. Please delete those before setting the interface to 'none' configuration."); |
|
586 |
} |
|
587 |
} |
|
588 |
} |
|
589 |
break; |
|
590 |
case "ppp": |
|
591 |
$reqdfields = explode(" ", "port phone"); |
|
592 |
$reqdfieldsn = array(gettext("Modem Port"), gettext("Phone Number")); |
|
593 |
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); |
|
594 |
break; |
|
595 |
case "pppoe": |
|
596 |
if ($_POST['pppoe_dialondemand']) { |
|
597 |
$reqdfields = explode(" ", "pppoe_username pppoe_password pppoe_dialondemand pppoe_idletimeout"); |
|
598 |
$reqdfieldsn = array(gettext("PPPoE username"), gettext("PPPoE password"), gettext("Dial on demand"), gettext("Idle timeout value")); |
|
599 |
} else { |
|
600 |
$reqdfields = explode(" ", "pppoe_username pppoe_password"); |
|
601 |
$reqdfieldsn = array(gettext("PPPoE username"), gettext("PPPoE password")); |
|
602 |
} |
|
603 |
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); |
|
604 |
break; |
|
605 |
case "pptp": |
|
606 |
if ($_POST['pptp_dialondemand']) { |
|
607 |
$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote pptp_dialondemand pptp_idletimeout"); |
|
608 |
$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")); |
|
609 |
} else { |
|
610 |
$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote"); |
|
611 |
$reqdfieldsn = array(gettext("PPTP username"), gettext("PPTP password"), gettext("PPTP local IP address"), gettext("PPTP subnet"), gettext("PPTP remote IP address")); |
|
612 |
} |
|
613 |
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); |
|
614 |
break; |
|
615 |
case "l2tp": |
|
616 |
if ($_POST['pptp_dialondemand']) { |
|
617 |
$reqdfields = explode(" ", "pptp_username pptp_password pptp_remote pptp_dialondemand pptp_idletimeout"); |
|
618 |
$reqdfieldsn = array(gettext("L2TP username"), gettext("L2TP password"), gettext("L2TP remote IP address"), gettext("Dial on demand"), gettext("Idle timeout value")); |
|
619 |
} else { |
|
620 |
$reqdfields = explode(" ", "pptp_username pptp_password pptp_remote"); |
|
621 |
$reqdfieldsn = array(gettext("L2TP username"), gettext("L2TP password"), gettext("L2TP remote IP address")); |
|
622 |
} |
|
623 |
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); |
|
624 |
break; |
|
625 |
} |
|
626 |
switch (strtolower($_POST['type6'])) { |
|
627 |
case "staticv6": |
|
628 |
$reqdfields = explode(" ", "ipaddrv6 subnetv6 gatewayv6"); |
|
629 |
$reqdfieldsn = array(gettext("IPv6 address"), gettext("Subnet bit count"), gettext("Gateway")); |
|
630 |
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); |
|
631 |
break; |
|
632 |
case "none": |
|
633 |
if (is_array($config['virtualip']['vip'])) { |
|
634 |
foreach ($config['virtualip']['vip'] as $vip) { |
|
635 |
if (is_ipaddrv6($vip['subnet']) && $vip['interface'] == $if) { |
|
636 |
$input_errors[] = gettext("This interface is referenced by IPv6 VIPs. Please delete those before setting the interface to 'none' configuration."); |
|
637 |
} |
|
638 |
} |
|
639 |
} |
|
640 |
break; |
|
641 |
case "dhcp6": |
|
642 |
if (in_array($wancfg['ipaddrv6'], array())) { |
|
643 |
$input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."), $_POST['type6']); |
|
644 |
} |
|
645 |
if ($_POST['dhcp6-ia-pd-send-hint'] && strtolower($_POST['dhcp6-ia-pd-len']) == 'none') { |
|
646 |
$input_errors[] = gettext('DHCPv6 Prefix Delegation size must be provided when Send IPv6 prefix hint flag is checked'); |
|
647 |
} |
|
648 |
break; |
|
649 |
case "6rd": |
|
650 |
foreach ($ifdescrs as $ifent => $ifdescr) { |
|
651 |
if ($if != $ifent && ($config[interfaces][$ifent]['ipaddrv6'] == $_POST['type6'])) { |
|
652 |
if ($config[interfaces][$ifent]['prefix-6rd'] == $_POST['prefix-6rd']) { |
|
653 |
$input_errors[] = gettext("You can only have one interface configured in 6rd with same prefix."); |
|
654 |
break; |
|
655 |
} |
|
656 |
} |
|
657 |
} |
|
658 |
if (in_array($wancfg['ipaddrv6'], array())) { |
|
659 |
$input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."), $_POST['type6']); |
|
660 |
} |
|
661 |
break; |
|
662 |
case "6to4": |
|
663 |
foreach ($ifdescrs as $ifent => $ifdescr) { |
|
664 |
if ($if != $ifent && ($config[interfaces][$ifent]['ipaddrv6'] == $_POST['type6'])) { |
|
665 |
$input_errors[] = sprintf(gettext("You can only have one interface configured as 6to4."), $_POST['type6']); |
|
666 |
break; |
|
667 |
} |
|
668 |
} |
|
669 |
if (in_array($wancfg['ipaddrv6'], array())) { |
|
670 |
$input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."), $_POST['type6']); |
|
671 |
} |
|
672 |
break; |
|
673 |
case "track6": |
|
674 |
/* needs to check if $track6-prefix-id is used on another interface */ |
|
675 |
if (in_array($wancfg['ipaddrv6'], array())) { |
|
676 |
$input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."), $_POST['type6']); |
|
677 |
} |
|
678 |
|
|
679 |
if ($_POST['track6-prefix-id--hex'] != "" && !is_numeric("0x" . $_POST['track6-prefix-id--hex'])) { |
|
680 |
$input_errors[] = gettext("You must enter a valid hexadecimal number for the IPv6 prefix ID."); |
|
681 |
} else { |
|
682 |
$track6_prefix_id = intval($_POST['track6-prefix-id--hex'], 16); |
|
683 |
if ($track6_prefix_id < 0 || $track6_prefix_id > $_POST['ipv6-num-prefix-ids-' . $_POST['track6-interface']]) { |
|
684 |
$input_errors[] = gettext("You specified an IPv6 prefix ID that is out of range.") . |
|
685 |
" ({$_POST['track6-interface']}) - (0) - (" . sprintf('%x', $_POST['ipv6-num-prefix-ids-' . $_POST['track6-interface']]) . ")"; |
|
686 |
} else { |
|
687 |
foreach ($ifdescrs as $ifent => $ifdescr) { |
|
688 |
if ($if == $ifent) { |
|
689 |
continue; |
|
690 |
} |
|
691 |
if ($config['interfaces'][$ifent]['ipaddrv6'] == 'track6' && |
|
692 |
$config['interfaces'][$ifent]['track6-interface'] == $_POST['track6-interface'] && |
|
693 |
$config['interfaces'][$ifent]['track6-prefix-id'] == $track6_prefix_id) { |
|
694 |
$input_errors[] = sprintf(gettext("This track6 prefix ID is already being used in %s."), $ifdescr); |
|
695 |
} |
|
696 |
} |
|
697 |
} |
|
698 |
} |
|
699 |
break; |
|
700 |
} |
|
701 |
|
|
702 |
/* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */ |
|
703 |
$staticroutes = get_staticroutes(true); |
|
704 |
$_POST['spoofmac'] = strtolower(str_replace("-", ":", $_POST['spoofmac'])); |
|
705 |
if ($_POST['ipaddr']) { |
|
706 |
if (!is_ipaddrv4($_POST['ipaddr'])) { |
|
707 |
$input_errors[] = gettext("A valid IPv4 address must be specified."); |
|
708 |
} else { |
|
709 |
$where_ipaddr_configured = where_is_ipaddr_configured($_POST['ipaddr'], $if, true, true, $_POST['subnet']); |
|
710 |
if (count($where_ipaddr_configured)) { |
|
711 |
$subnet_conflict_text = sprintf(gettext("IPv4 address %s is being used by or overlaps with:"), $_POST['ipaddr'] . "/" . $_POST['subnet']); |
|
712 |
foreach ($where_ipaddr_configured as $subnet_conflict) { |
|
713 |
$subnet_conflict_text .= " " . convert_friendly_interface_to_friendly_descr($subnet_conflict['if']) . " (" . $subnet_conflict['ip_or_subnet'] . ")"; |
|
714 |
} |
|
715 |
$input_errors[] = $subnet_conflict_text; |
|
716 |
} |
|
717 |
|
|
718 |
/* Do not accept network or broadcast address, except if subnet is 31 or 32 */ |
|
719 |
if ($_POST['subnet'] < 31) { |
|
720 |
if ($_POST['ipaddr'] == gen_subnet($_POST['ipaddr'], $_POST['subnet'])) { |
|
721 |
$input_errors[] = gettext("This IPv4 address is the network address and cannot be used"); |
|
722 |
} else if ($_POST['ipaddr'] == gen_subnet_max($_POST['ipaddr'], $_POST['subnet'])) { |
|
723 |
$input_errors[] = gettext("This IPv4 address is the broadcast address and cannot be used"); |
|
724 |
} |
|
725 |
} |
|
726 |
|
|
727 |
foreach ($staticroutes as $route_subnet) { |
|
728 |
list($network, $subnet) = explode("/", $route_subnet); |
|
729 |
if ($_POST['subnet'] == $subnet && $network == gen_subnet($_POST['ipaddr'], $_POST['subnet'])) { |
|
730 |
$input_errors[] = gettext("This IPv4 address conflicts with a Static Route."); |
|
731 |
break; |
|
732 |
} |
|
733 |
unset($network, $subnet); |
|
734 |
} |
|
735 |
} |
|
736 |
} |
|
737 |
if ($_POST['ipaddrv6']) { |
|
738 |
if (!is_ipaddrv6($_POST['ipaddrv6'])) { |
|
739 |
$input_errors[] = gettext("A valid IPv6 address must be specified."); |
|
740 |
} else { |
|
741 |
$where_ipaddr_configured = where_is_ipaddr_configured($_POST['ipaddrv6'], $if, true, true, $_POST['subnetv6']); |
|
742 |
if (count($where_ipaddr_configured)) { |
|
743 |
$subnet_conflict_text = sprintf(gettext("IPv6 address %s is being used by or overlaps with:"), $_POST['ipaddrv6'] . "/" . $_POST['subnetv6']); |
|
744 |
foreach ($where_ipaddr_configured as $subnet_conflict) { |
|
745 |
$subnet_conflict_text .= " " . convert_friendly_interface_to_friendly_descr($subnet_conflict['if']) . " (" . $subnet_conflict['ip_or_subnet'] . ")"; |
|
746 |
} |
|
747 |
$input_errors[] = $subnet_conflict_text; |
|
748 |
} |
|
749 |
|
|
750 |
foreach ($staticroutes as $route_subnet) { |
|
751 |
list($network, $subnet) = explode("/", $route_subnet); |
|
752 |
if ($_POST['subnetv6'] == $subnet && $network == gen_subnetv6($_POST['ipaddrv6'], $_POST['subnetv6'])) { |
|
753 |
$input_errors[] = gettext("This IPv6 address conflicts with a Static Route."); |
|
754 |
break; |
|
755 |
} |
|
756 |
unset($network, $subnet); |
|
757 |
} |
|
758 |
} |
|
759 |
} |
|
760 |
if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) { |
|
761 |
$input_errors[] = gettext("A valid subnet bit count must be specified."); |
|
762 |
} |
|
763 |
if (($_POST['subnetv6'] && !is_numeric($_POST['subnetv6']))) { |
|
764 |
$input_errors[] = gettext("A valid subnet bit count must be specified."); |
|
765 |
} |
|
766 |
if (($_POST['alias-address'] && !is_ipaddrv4($_POST['alias-address']))) { |
|
767 |
$input_errors[] = gettext("A valid alias IP address must be specified."); |
|
768 |
} |
|
769 |
if (($_POST['alias-subnet'] && !is_numeric($_POST['alias-subnet']))) { |
|
770 |
$input_errors[] = gettext("A valid alias subnet bit count must be specified."); |
|
771 |
} |
|
772 |
if ($_POST['dhcprejectfrom'] && !is_ipaddrv4($_POST['dhcprejectfrom'])) { |
|
773 |
$input_errors[] = gettext("A valid alias IP address must be specified to reject DHCP Leases from."); |
|
774 |
} |
|
775 |
if (($_POST['gateway'] != "none") || ($_POST['gatewayv6'] != "none")) { |
|
776 |
$match = false; |
|
777 |
foreach ($a_gateways as $gateway) { |
|
778 |
if (in_array($_POST['gateway'], $gateway)) { |
|
779 |
$match = true; |
|
780 |
} |
|
781 |
} |
|
782 |
foreach ($a_gateways as $gateway) { |
|
783 |
if (in_array($_POST['gatewayv6'], $gateway)) { |
|
784 |
$match = true; |
|
785 |
} |
|
786 |
} |
|
787 |
if (!$match) { |
|
788 |
$input_errors[] = gettext("A valid gateway must be specified."); |
|
789 |
} |
|
790 |
} |
|
791 |
if (($_POST['provider'] && !is_domain($_POST['provider']))) { |
|
792 |
$input_errors[] = gettext("The service name contains invalid characters."); |
|
793 |
} |
|
794 |
if (($_POST['pppoe_idletimeout'] != "") && !is_numericint($_POST['pppoe_idletimeout'])) { |
|
795 |
$input_errors[] = gettext("The idle timeout value must be an integer."); |
|
796 |
} |
|
797 |
if ($_POST['pppoe_resethour'] != "" && !is_numericint($_POST['pppoe_resethour']) && |
|
798 |
$_POST['pppoe_resethour'] >= 0 && $_POST['pppoe_resethour'] <=23) { |
|
799 |
$input_errors[] = gettext("A valid PPPoE reset hour must be specified (0-23)."); |
|
800 |
} |
|
801 |
if ($_POST['pppoe_resetminute'] != "" && !is_numericint($_POST['pppoe_resetminute']) && |
|
802 |
$_POST['pppoe_resetminute'] >= 0 && $_POST['pppoe_resetminute'] <=59) { |
|
803 |
$input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59)."); |
|
804 |
} |
|
805 |
if ($_POST['pppoe_resetdate'] != "" && !is_numeric(str_replace("/", "", $_POST['pppoe_resetdate']))) { |
|
806 |
$input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy)."); |
|
807 |
} |
|
808 |
if (($_POST['pptp_local'] && !is_ipaddrv4($_POST['pptp_local']))) { |
|
809 |
$input_errors[] = gettext("A valid PPTP local IP address must be specified."); |
|
810 |
} |
|
811 |
if (($_POST['pptp_subnet'] && !is_numeric($_POST['pptp_subnet']))) { |
|
812 |
$input_errors[] = gettext("A valid PPTP subnet bit count must be specified."); |
|
813 |
} |
|
814 |
if (($_POST['pptp_remote'] && !is_ipaddrv4($_POST['pptp_remote']) && !is_hostname($_POST['gateway'][$iface]))) { |
|
815 |
$input_errors[] = gettext("A valid PPTP remote IP address must be specified."); |
|
816 |
} |
|
817 |
if (($_POST['pptp_idletimeout'] != "") && !is_numericint($_POST['pptp_idletimeout'])) { |
|
818 |
$input_errors[] = gettext("The idle timeout value must be an integer."); |
|
819 |
} |
|
820 |
if (($_POST['spoofmac'] && !is_macaddr($_POST['spoofmac']))) { |
|
821 |
$input_errors[] = gettext("A valid MAC address must be specified."); |
|
822 |
} |
|
823 |
if ($_POST['mtu']) { |
|
824 |
if (!is_numericint($_POST['mtu'])) { |
|
825 |
$input_errors[] = "MTU must be an integer."; |
|
826 |
} |
|
827 |
if (substr($wancfg['if'], 0, 3) == 'gif') { |
|
828 |
$min_mtu = 1280; |
|
829 |
$max_mtu = 8192; |
|
830 |
} else { |
|
831 |
$min_mtu = 576; |
|
832 |
$max_mtu = 9000; |
|
833 |
} |
|
834 |
|
|
835 |
if ($_POST['mtu'] < $min_mtu || $_POST['mtu'] > $max_mtu) { |
|
836 |
$input_errors[] = sprintf(gettext("The MTU must be between %d and %d bytes."), $min_mtu, $max_mtu); |
|
837 |
} |
|
838 |
|
|
839 |
unset($min_mtu, $max_mtu); |
|
840 |
|
|
841 |
if (stristr($wancfg['if'], "_vlan")) { |
|
842 |
$realhwif_array = get_parent_interface($wancfg['if']); |
|
843 |
// Need code to handle MLPPP if we ever use $realhwif for MLPPP handling |
|
844 |
$parent_realhwif = $realhwif_array[0]; |
|
845 |
$parent_if = convert_real_interface_to_friendly_interface_name($parent_realhwif); |
|
846 |
if (!empty($parent_if) && !empty($config['interfaces'][$parent_if]['mtu'])) { |
|
847 |
if ($_POST['mtu'] > intval($config['interfaces'][$parent_if]['mtu'])) { |
|
848 |
$input_errors[] = gettext("The MTU of a VLAN cannot be greater than that of its parent interface."); |
|
849 |
} |
|
850 |
} |
|
851 |
} else { |
|
852 |
foreach ($config['interfaces'] as $idx => $ifdata) { |
|
853 |
if (($idx == $if) || !preg_match('/_vlan[0-9]/', $ifdata['if'])) { |
|
854 |
continue; |
|
855 |
} |
|
856 |
|
|
857 |
$realhwif_array = get_parent_interface($ifdata['if']); |
|
858 |
// Need code to handle MLPPP if we ever use $realhwif for MLPPP handling |
|
859 |
$parent_realhwif = $realhwif_array[0]; |
|
860 |
|
|
861 |
if ($parent_realhwif != $wancfg['if']) { |
|
862 |
continue; |
|
863 |
} |
|
864 |
|
|
865 |
if (isset($ifdata['mtu']) && $ifdata['mtu'] > $_POST['mtu']) { |
|
866 |
$input_errors[] = sprintf(gettext("Interface %s (VLAN) has MTU set to a larger value"), $ifdata['descr']); |
|
867 |
} |
|
868 |
} |
|
869 |
} |
|
870 |
} |
|
871 |
if ($_POST['mss'] != '') { |
|
872 |
if (!is_numericint($_POST['mss']) || ($_POST['mss'] < 576 || $_POST['mss'] > 65535)) { |
|
873 |
$input_errors[] = gettext("The MSS must be an integer between 576 and 65535 bytes."); |
|
874 |
} |
|
875 |
} |
|
876 |
/* Wireless interface? */ |
|
877 |
if (isset($wancfg['wireless'])) { |
|
878 |
$reqdfields = array("mode"); |
|
879 |
$reqdfieldsn = array(gettext("Mode")); |
|
880 |
if ($_POST['mode'] == 'hostap') { |
|
881 |
$reqdfields[] = "ssid"; |
|
882 |
$reqdfieldsn[] = gettext("SSID"); |
|
883 |
if (isset($_POST['channel']) && $_POST['channel'] == "0") { |
|
884 |
// auto channel with hostap is broken, prevent this for now. |
|
885 |
$input_errors[] = gettext("A specific channel, not auto, must be selected for Access Point mode."); |
|
886 |
} |
|
887 |
} |
|
888 |
if (stristr($_POST['standard'], '11n')) { |
|
889 |
if (!($_POST['wme_enable'])) { |
|
890 |
$input_errors[] = gettext("802.11n standards require enabling WME."); |
|
891 |
} |
|
892 |
} |
|
893 |
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); |
|
894 |
check_wireless_mode(); |
|
895 |
if (isset($_POST['wpa_group_rekey']) && (!is_numericint($_POST['wpa_group_rekey']) || $_POST['wpa_group_rekey'] < 1 || $_POST['wpa_group_rekey'] > 9999)) { |
|
896 |
$input_errors[] = gettext("Key Rotation must be an integer between 1 and 9999."); |
|
897 |
} |
|
898 |
if (isset($_POST['wpa_gmk_rekey']) && (!is_numericint($_POST['wpa_gmk_rekey']) || $_POST['wpa_gmk_rekey'] < 1 || $_POST['wpa_gmk_rekey'] > 9999)) { |
|
899 |
$input_errors[] = gettext("Master Key Regeneration must be an integer between 1 and 9999."); |
|
900 |
} |
|
901 |
if (isset($_POST['wpa_group_rekey']) && isset($_POST['wpa_gmk_rekey'])) { |
|
902 |
if ($_POST['wpa_group_rekey'] > $_POST['wpa_gmk_rekey']) { |
|
903 |
$input_errors[] = gettext("Master Key Regeneration must be greater than Key Rotation."); |
|
904 |
} |
|
905 |
} |
|
906 |
if (!empty($_POST['auth_server_addr'])) { |
|
907 |
if (!is_domain($_POST['auth_server_addr']) && !is_ipaddr($_POST['auth_server_addr'])) { |
|
908 |
$input_errors[] = gettext("802.1X Authentication Server must be an IP or hostname."); |
|
909 |
} |
|
910 |
} |
|
911 |
if (!empty($_POST['auth_server_addr2'])) { |
|
912 |
if (!is_domain($_POST['auth_server_addr2']) && !is_ipaddr($_POST['auth_server_addr2'])) { |
|
913 |
$input_errors[] = gettext("Secondary 802.1X Authentication Server must be an IP or hostname."); |
|
914 |
} |
|
915 |
} |
|
916 |
if (!empty($_POST['auth_server_port'])) { |
|
917 |
if (!is_port($_POST['auth_server_port'])) { |
|
918 |
$input_errors[] = gettext("802.1X Authentication Server Port must be a valid port number (1-65535)."); |
|
919 |
} |
|
920 |
} |
|
921 |
if (!empty($_POST['auth_server_port2'])) { |
|
922 |
if (!is_port($_POST['auth_server_port2'])) { |
|
923 |
$input_errors[] = gettext("Secondary 802.1X Authentication Server Port must be a valid port number (1-65535)."); |
|
924 |
} |
|
925 |
} |
|
926 |
if (isset($_POST['channel']) && !is_numericint($_POST['channel'])) { |
|
927 |
if (!is_numericint($_POST['channel'])) { |
|
928 |
$input_errors[] = gettext("Invalid channel specified."); |
|
929 |
} else { |
|
930 |
if ($_POST['channel'] > 255 || $_POST['channel'] < 0) { |
|
931 |
$input_errors[] = gettext("Channel must be between 0-255."); |
|
932 |
} |
|
933 |
} |
|
934 |
} |
|
935 |
if (!empty($_POST['distance']) && !is_numericint($_POST['distance'])) { |
|
936 |
$input_errors[] = gettext("Distance must be an integer."); |
|
937 |
} |
|
938 |
if (isset($_POST['standard']) && (stristr($_POST['standard'], '11na') || stristr($_POST['standard'], '11a'))) { |
|
939 |
if ($_POST['channel'] != 0 && $_POST['channel'] < 15) { |
|
940 |
$input_errors[] = gettext("Channel selected is not valid for 802.11a or 802.11na."); |
|
941 |
} |
|
942 |
} |
|
943 |
if (isset($_POST['standard']) && ($_POST['standard'] == "11b" || $_POST['standard'] == "11g")) { |
|
944 |
if ($_POST['channel'] > 14) { |
|
945 |
$input_errors[] = gettext("Channel selected is not valid for 802.11b or 802.11g."); |
|
946 |
} |
|
947 |
} |
|
948 |
if (!empty($_POST['protmode']) && !in_array($_POST['protmode'], array("off", "cts", "rtscts"))) { |
|
949 |
$input_errors[] = gettext("Invalid option chosen for OFDM Protection Mode"); |
|
950 |
} |
|
951 |
|
|
952 |
if(ALLOWWEP) { |
|
953 |
/* loop through keys and enforce size */ |
|
954 |
for ($i = 1; $i <= 4; $i++) { |
|
955 |
if ($_POST['key' . $i]) { |
|
956 |
/* 64 bit */ |
|
957 |
if (strlen($_POST['key' . $i]) == 5) { |
|
958 |
continue; |
|
959 |
} |
|
960 |
|
|
961 |
if (strlen($_POST['key' . $i]) == 10) { |
|
962 |
/* hex key */ |
|
963 |
if (stristr($_POST['key' . $i], "0x") == false) { |
|
964 |
$_POST['key' . $i] = "0x" . $_POST['key' . $i]; |
|
965 |
} |
|
966 |
continue; |
|
967 |
} |
|
968 |
|
|
969 |
if (strlen($_POST['key' . $i]) == 12) { |
|
970 |
/* hex key */ |
|
971 |
if (stristr($_POST['key' . $i], "0x") == false) { |
|
972 |
$_POST['key' . $i] = "0x" . $_POST['key' . $i]; |
|
973 |
} |
|
974 |
continue; |
|
975 |
} |
|
976 |
|
|
977 |
/* 128 bit */ |
|
978 |
if (strlen($_POST['key' . $i]) == 13) { |
|
979 |
continue; |
|
980 |
} |
|
981 |
|
|
982 |
if (strlen($_POST['key' . $i]) == 26) { |
|
983 |
/* hex key */ |
|
984 |
if (stristr($_POST['key' . $i], "0x") == false) { |
|
985 |
$_POST['key' . $i] = "0x" . $_POST['key' . $i]; |
|
986 |
} |
|
987 |
continue; |
|
988 |
} |
|
989 |
|
|
990 |
if (strlen($_POST['key' . $i]) == 28) { |
|
991 |
continue; |
|
992 |
} |
|
993 |
|
|
994 |
$input_errors[] = gettext("Invalid WEP key. Enter a valid 40, 64, 104 or 128 bit WEP key."); |
|
995 |
break; |
|
996 |
} |
|
997 |
} |
|
998 |
} |
|
999 |
|
|
1000 |
if ($_POST['passphrase']) { |
|
1001 |
$passlen = strlen($_POST['passphrase']); |
|
1002 |
if ($passlen < 8 || $passlen > 63) { |
|
1003 |
$input_errors[] = gettext("The WPA passphrase must be between 8 and 63 characters long."); |
|
1004 |
} |
|
1005 |
} |
|
1006 |
|
|
1007 |
if ($_POST['wpa_enable'] == "yes") { |
|
1008 |
if (empty($_POST['passphrase']) && stristr($_POST['wpa_key_mgmt'], "WPA-PSK")) { |
|
1009 |
$input_errors[] = gettext("A WPA Passphrase must be specified when WPA PSK is enabled."); |
|
1010 |
} |
|
1011 |
} |
|
1012 |
} |
|
1013 |
if (!$input_errors) { |
|
1014 |
if ($wancfg['ipaddr'] != $_POST['type']) { |
|
1015 |
if (in_array($wancfg['ipaddr'], array("ppp", "pppoe", "pptp", "l2tp"))) { |
|
1016 |
$wancfg['if'] = $a_ppps[$pppid]['ports']; |
|
1017 |
unset($a_ppps[$pppid]); |
|
1018 |
} else if ($wancfg['ipaddr'] == "dhcp") { |
|
1019 |
kill_dhclient_process($wancfg['if']); |
|
1020 |
} |
|
1021 |
if ($wancfg['ipaddrv6'] == "dhcp6") { |
|
1022 |
$pid = find_dhcp6c_process($wancfg['if']); |
|
1023 |
if ($pid) { |
|
1024 |
posix_kill($pid, SIGTERM); |
|
1025 |
} |
|
1026 |
} |
|
1027 |
} |
|
1028 |
$ppp = array(); |
|
1029 |
if ($wancfg['ipaddr'] != "ppp") { |
|
1030 |
unset($wancfg['ipaddr']); |
|
1031 |
} |
|
1032 |
if ($wancfg['ipaddrv6'] != "ppp") { |
|
1033 |
unset($wancfg['ipaddrv6']); |
|
1034 |
} |
|
1035 |
unset($wancfg['subnet']); |
|
1036 |
unset($wancfg['gateway']); |
|
1037 |
unset($wancfg['subnetv6']); |
|
1038 |
unset($wancfg['gatewayv6']); |
|
1039 |
unset($wancfg['dhcphostname']); |
|
1040 |
unset($wancfg['dhcprejectfrom']); |
|
1041 |
unset($wancfg['dhcp6-duid']); |
|
1042 |
unset($wancfg['dhcp6-ia-pd-len']); |
|
1043 |
unset($wancfg['dhcp6-ia-pd-send-hint']); |
|
1044 |
unset($wancfg['dhcp6prefixonly']); |
|
1045 |
unset($wancfg['dhcp6usev4iface']); |
|
1046 |
unset($wancfg['track6-interface']); |
|
1047 |
unset($wancfg['track6-prefix-id']); |
|
1048 |
unset($wancfg['prefix-6rd']); |
|
1049 |
unset($wancfg['prefix-6rd-v4plen']); |
|
1050 |
unset($wancfg['gateway-6rd']); |
|
1051 |
|
|
1052 |
unset($wancfg['adv_dhcp_pt_timeout']); |
|
1053 |
unset($wancfg['adv_dhcp_pt_retry']); |
|
1054 |
unset($wancfg['adv_dhcp_pt_select_timeout']); |
|
1055 |
unset($wancfg['adv_dhcp_pt_reboot']); |
|
1056 |
unset($wancfg['adv_dhcp_pt_backoff_cutoff']); |
|
1057 |
unset($wancfg['adv_dhcp_pt_initial_interval']); |
|
1058 |
|
|
1059 |
unset($wancfg['adv_dhcp_pt_values']); |
|
1060 |
|
|
1061 |
unset($wancfg['adv_dhcp_send_options']); |
|
1062 |
unset($wancfg['adv_dhcp_request_options']); |
|
1063 |
unset($wancfg['adv_dhcp_required_options']); |
|
1064 |
unset($wancfg['adv_dhcp_option_modifiers']); |
|
1065 |
|
|
1066 |
unset($wancfg['adv_dhcp_config_advanced']); |
|
1067 |
unset($wancfg['adv_dhcp_config_file_override']); |
|
1068 |
unset($wancfg['adv_dhcp_config_file_override_path']); |
|
1069 |
|
|
1070 |
unset($wancfg['adv_dhcp6_interface_statement_send_options']); |
|
1071 |
unset($wancfg['adv_dhcp6_interface_statement_request_options']); |
|
1072 |
unset($wancfg['adv_dhcp6_interface_statement_information_only_enable']); |
|
1073 |
unset($wancfg['adv_dhcp6_interface_statement_script']); |
|
1074 |
|
|
1075 |
unset($wancfg['adv_dhcp6_id_assoc_statement_address_enable']); |
|
1076 |
unset($wancfg['adv_dhcp6_id_assoc_statement_address']); |
|
1077 |
unset($wancfg['adv_dhcp6_id_assoc_statement_address_id']); |
|
1078 |
unset($wancfg['adv_dhcp6_id_assoc_statement_address_pltime']); |
|
1079 |
unset($wancfg['adv_dhcp6_id_assoc_statement_address_vltime']); |
|
1080 |
|
|
1081 |
unset($wancfg['adv_dhcp6_id_assoc_statement_prefix_enable']); |
|
1082 |
unset($wancfg['adv_dhcp6_id_assoc_statement_prefix']); |
|
1083 |
unset($wancfg['adv_dhcp6_id_assoc_statement_prefix_id']); |
|
1084 |
unset($wancfg['adv_dhcp6_id_assoc_statement_prefix_pltime']); |
|
1085 |
unset($wancfg['adv_dhcp6_id_assoc_statement_prefix_vltime']); |
|
1086 |
|
|
1087 |
unset($wancfg['adv_dhcp6_prefix_interface_statement_sla_id']); |
|
1088 |
unset($wancfg['adv_dhcp6_prefix_interface_statement_sla_len']); |
|
1089 |
|
|
1090 |
unset($wancfg['adv_dhcp6_authentication_statement_authname']); |
|
1091 |
unset($wancfg['adv_dhcp6_authentication_statement_protocol']); |
|
1092 |
unset($wancfg['adv_dhcp6_authentication_statement_algorithm']); |
|
1093 |
unset($wancfg['adv_dhcp6_authentication_statement_rdm']); |
|
1094 |
|
|
1095 |
unset($wancfg['adv_dhcp6_key_info_statement_keyname']); |
|
1096 |
unset($wancfg['adv_dhcp6_key_info_statement_realm']); |
|
1097 |
unset($wancfg['adv_dhcp6_key_info_statement_keyid']); |
|
1098 |
unset($wancfg['adv_dhcp6_key_info_statement_secret']); |
|
1099 |
unset($wancfg['adv_dhcp6_key_info_statement_expire']); |
|
1100 |
|
|
1101 |
unset($wancfg['adv_dhcp6_config_advanced']); |
|
1102 |
unset($wancfg['adv_dhcp6_config_file_override']); |
|
1103 |
unset($wancfg['adv_dhcp6_config_file_override_path']); |
|
1104 |
|
|
1105 |
unset($wancfg['pppoe_password']); |
|
1106 |
unset($wancfg['pptp_username']); |
|
1107 |
unset($wancfg['pptp_password']); |
|
1108 |
unset($wancfg['provider']); |
|
1109 |
unset($wancfg['ondemand']); |
|
1110 |
unset($wancfg['timeout']); |
|
1111 |
if (empty($wancfg['pppoe']['pppoe-reset-type'])) { |
|
1112 |
unset($wancfg['pppoe']['pppoe-reset-type']); |
|
1113 |
} |
|
1114 |
unset($wancfg['local']); |
|
1115 |
|
|
1116 |
unset($wancfg['remote']); |
|
1117 |
if (is_array($a_ppps[$pppid]) && in_array($wancfg['ipaddr'], array("ppp", "pppoe", "pptp", "l2tp"))) { |
|
1118 |
if ($wancfg['ipaddr'] != 'ppp') { |
|
1119 |
unset($a_ppps[$pppid]['apn']); |
|
1120 |
unset($a_ppps[$pppid]['phone']); |
|
1121 |
unset($a_ppps[$pppid]['provider']); |
|
1122 |
unset($a_ppps[$pppid]['ondemand']); |
|
1123 |
} |
|
1124 |
if (in_array($wancfg['ipaddr'], array("pppoe", "pptp", "l2tp"))) { |
|
1125 |
unset($a_ppps[$pppid]['localip']); |
|
1126 |
unset($a_ppps[$pppid]['subnet']); |
|
1127 |
unset($a_ppps[$pppid]['gateway']); |
|
1128 |
} |
|
1129 |
if ($wancfg['ipaddr'] != 'pppoe') { |
|
1130 |
unset($a_ppps[$pppid]['pppoe-reset-type']); |
|
1131 |
} |
|
1132 |
if ($wancfg['type'] != $_POST['type']) { |
|
1133 |
unset($a_ppps[$pppid]['idletimeout']); |
|
1134 |
} |
|
1135 |
} |
|
1136 |
|
|
1137 |
$wancfg['descr'] = remove_bad_chars($_POST['descr']); |
|
1138 |
$wancfg['enable'] = $_POST['enable'] == "yes" ? true : false; |
|
1139 |
|
|
1140 |
/* let return_gateways_array() do the magic on dynamic interfaces for us */ |
|
1141 |
switch ($_POST['type']) { |
|
1142 |
case "staticv4": |
|
1143 |
$wancfg['ipaddr'] = $_POST['ipaddr']; |
|
1144 |
$wancfg['subnet'] = $_POST['subnet']; |
|
1145 |
if ($_POST['gateway'] != "none") { |
|
1146 |
$wancfg['gateway'] = $_POST['gateway']; |
|
1147 |
} |
|
1148 |
break; |
|
1149 |
case "dhcp": |
|
1150 |
$wancfg['ipaddr'] = "dhcp"; |
|
1151 |
$wancfg['dhcphostname'] = $_POST['dhcphostname']; |
|
1152 |
$wancfg['alias-address'] = $_POST['alias-address']; |
|
1153 |
$wancfg['alias-subnet'] = $_POST['alias-subnet']; |
|
1154 |
$wancfg['dhcprejectfrom'] = $_POST['dhcprejectfrom']; |
|
1155 |
|
|
1156 |
$wancfg['adv_dhcp_pt_timeout'] = $_POST['adv_dhcp_pt_timeout']; |
|
1157 |
$wancfg['adv_dhcp_pt_retry'] = $_POST['adv_dhcp_pt_retry']; |
|
1158 |
$wancfg['adv_dhcp_pt_select_timeout'] = $_POST['adv_dhcp_pt_select_timeout']; |
|
1159 |
$wancfg['adv_dhcp_pt_reboot'] = $_POST['adv_dhcp_pt_reboot']; |
|
1160 |
$wancfg['adv_dhcp_pt_backoff_cutoff'] = $_POST['adv_dhcp_pt_backoff_cutoff']; |
|
1161 |
$wancfg['adv_dhcp_pt_initial_interval'] = $_POST['adv_dhcp_pt_initial_interval']; |
|
1162 |
|
|
1163 |
$wancfg['adv_dhcp_pt_values'] = $_POST['adv_dhcp_pt_values']; |
|
1164 |
|
|
1165 |
$wancfg['adv_dhcp_send_options'] = $_POST['adv_dhcp_send_options']; |
|
1166 |
$wancfg['adv_dhcp_request_options'] = $_POST['adv_dhcp_request_options']; |
|
1167 |
$wancfg['adv_dhcp_required_options'] = $_POST['adv_dhcp_required_options']; |
|
1168 |
$wancfg['adv_dhcp_option_modifiers'] = $_POST['adv_dhcp_option_modifiers']; |
|
1169 |
|
|
1170 |
$wancfg['adv_dhcp_config_advanced'] = $_POST['adv_dhcp_config_advanced']; |
|
1171 |
$wancfg['adv_dhcp_config_file_override'] = $_POST['adv_dhcp_config_file_override']; |
|
1172 |
$wancfg['adv_dhcp_config_file_override_path'] = $_POST['adv_dhcp_config_file_override_path']; |
|
1173 |
|
|
1174 |
$wancfg['dhcp_plus'] = $_POST['dhcp_plus'] == "yes" ? true : false; |
|
1175 |
if ($gateway_item) { |
|
1176 |
$a_gateways[] = $gateway_item; |
|
1177 |
} |
|
1178 |
break; |
|
1179 |
case "ppp": |
|
1180 |
$a_ppps[$pppid]['ptpid'] = $_POST['ptpid']; |
|
1181 |
$a_ppps[$pppid]['type'] = $_POST['type']; |
|
1182 |
$a_ppps[$pppid]['if'] = $_POST['type'].$_POST['ptpid']; |
|
1183 |
$a_ppps[$pppid]['ports'] = $_POST['port']; |
|
1184 |
$a_ppps[$pppid]['username'] = $_POST['ppp_username']; |
|
1185 |
$a_ppps[$pppid]['password'] = base64_encode($_POST['ppp_password']); |
|
1186 |
$a_ppps[$pppid]['phone'] = $_POST['phone']; |
|
1187 |
$a_ppps[$pppid]['apn'] = $_POST['apn']; |
|
1188 |
$wancfg['if'] = $_POST['type'] . $_POST['ptpid']; |
|
1189 |
$wancfg['ipaddr'] = $_POST['type']; |
|
1190 |
break; |
|
1191 |
|
|
1192 |
case "pppoe": |
|
1193 |
$a_ppps[$pppid]['ptpid'] = $_POST['ptpid']; |
|
1194 |
$a_ppps[$pppid]['type'] = $_POST['type']; |
|
1195 |
$a_ppps[$pppid]['if'] = $_POST['type'].$_POST['ptpid']; |
|
1196 |
if (isset($_POST['ppp_port'])) { |
|
1197 |
$a_ppps[$pppid]['ports'] = $_POST['ppp_port']; |
|
1198 |
} else { |
|
1199 |
$a_ppps[$pppid]['ports'] = $wancfg['if']; |
|
1200 |
} |
|
1201 |
$a_ppps[$pppid]['username'] = $_POST['pppoe_username']; |
|
1202 |
$a_ppps[$pppid]['password'] = base64_encode($_POST['pppoe_password']); |
|
1203 |
if (!empty($_POST['provider'])) { |
|
1204 |
$a_ppps[$pppid]['provider'] = $_POST['provider']; |
|
1205 |
} else { |
|
1206 |
$a_ppps[$pppid]['provider'] = true; |
|
1207 |
} |
|
1208 |
$a_ppps[$pppid]['ondemand'] = $_POST['pppoe_dialondemand'] ? true : false; |
|
1209 |
if (!empty($_POST['pppoe_idletimeout'])) { |
|
1210 |
$a_ppps[$pppid]['idletimeout'] = $_POST['pppoe_idletimeout']; |
|
1211 |
} else { |
|
1212 |
unset($a_ppps[$pppid]['idletimeout']); |
|
1213 |
} |
|
1214 |
|
|
1215 |
if (!empty($_POST['pppoe-reset-type'])) { |
|
1216 |
$a_ppps[$pppid]['pppoe-reset-type'] = $_POST['pppoe-reset-type']; |
|
1217 |
} else { |
Also available in: Unified diff
Revert "Fixed #5148"
Accidentally broke spaces/tabs
This reverts commit 910b77ad1682740e481df29fc2d9c528a13c2da4.