1 |
e2cd32df
|
Scott Ullrich
|
<?php
|
2 |
b46bfcf5
|
Bill Marquette
|
/* $Id$ */
|
3 |
5b237745
|
Scott Ullrich
|
/*
|
4 |
|
|
interfaces_wan.php
|
5 |
9575504e
|
Scott Ullrich
|
Copyright (C) 2004 Scott Ullrich
|
6 |
c3b3cd36
|
Scott Ullrich
|
All rights reserved.
|
7 |
b1c525ee
|
Scott Ullrich
|
|
8 |
c3b3cd36
|
Scott Ullrich
|
originally part of m0n0wall (http://m0n0.ch/wall)
|
9 |
5b237745
|
Scott Ullrich
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
10 |
|
|
All rights reserved.
|
11 |
e2cd32df
|
Scott Ullrich
|
|
12 |
5b237745
|
Scott Ullrich
|
Redistribution and use in source and binary forms, with or without
|
13 |
|
|
modification, are permitted provided that the following conditions are met:
|
14 |
e2cd32df
|
Scott Ullrich
|
|
15 |
5b237745
|
Scott Ullrich
|
1. Redistributions of source code must retain the above copyright notice,
|
16 |
|
|
this list of conditions and the following disclaimer.
|
17 |
e2cd32df
|
Scott Ullrich
|
|
18 |
5b237745
|
Scott Ullrich
|
2. Redistributions in binary form must reproduce the above copyright
|
19 |
|
|
notice, this list of conditions and the following disclaimer in the
|
20 |
|
|
documentation and/or other materials provided with the distribution.
|
21 |
e2cd32df
|
Scott Ullrich
|
|
22 |
5b237745
|
Scott Ullrich
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
23 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
24 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
25 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
26 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
27 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
28 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
29 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
30 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
31 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
32 |
|
|
*/
|
33 |
|
|
|
34 |
58af5941
|
Scott Ullrich
|
define("CRON_MONTHLY_PATTERN", "0 0 1 * *");
|
35 |
|
|
define("CRON_WEEKLY_PATTERN", "0 0 * * 0");
|
36 |
|
|
define("CRON_DAILY_PATTERN", "0 0 * * *");
|
37 |
|
|
define("CRON_HOURLY_PATTERN", "0 * * * *");
|
38 |
|
|
define("CRON_PPPOE_CMD_FILE", "/etc/pppoerestart");
|
39 |
8171fcd9
|
Scott Ullrich
|
define("CRON_PPPOE_CMD", "#!/bin/sh\necho '<?php require(\"interfaces.inc\"); interfaces_wan_pppoe_restart(); services_dyndns_reset(); ?>' | /usr/local/bin/php -q");
|
40 |
58af5941
|
Scott Ullrich
|
|
41 |
|
|
function getMPDCRONSettings() {
|
42 |
|
|
global $config;
|
43 |
|
|
|
44 |
|
|
if (is_array($config['cron']['item'])) {
|
45 |
|
|
for ($i = 0; $i < count($config['cron']['item']); $i++) {
|
46 |
|
|
$item =& $config['cron']['item'][$i];
|
47 |
|
|
|
48 |
|
|
if (strpos($item['command'], CRON_PPPOE_CMD_FILE) !== false) {
|
49 |
|
|
return array("ID" => $i, "ITEM" => $item);
|
50 |
|
|
}
|
51 |
|
|
}
|
52 |
|
|
}
|
53 |
|
|
|
54 |
|
|
return NULL;
|
55 |
|
|
}
|
56 |
|
|
|
57 |
|
|
function getMPDResetTimeFromConfig() {
|
58 |
|
|
$itemhash = getMPDCRONSettings();
|
59 |
|
|
$cronitem = $itemhash['ITEM'];
|
60 |
|
|
|
61 |
|
|
if (isset($cronitem)) {
|
62 |
|
|
|
63 |
|
|
return "{$cronitem['minute']} {$cronitem['hour']} {$cronitem['mday']} {$cronitem['month']} {$cronitem['wday']}";
|
64 |
|
|
} else {
|
65 |
|
|
return NULL;
|
66 |
|
|
}
|
67 |
|
|
}
|
68 |
|
|
|
69 |
5b237745
|
Scott Ullrich
|
require("guiconfig.inc");
|
70 |
|
|
|
71 |
|
|
$wancfg = &$config['interfaces']['wan'];
|
72 |
8bb29531
|
Scott Ullrich
|
$optcfg = &$config['interfaces']['wan'];
|
73 |
5b237745
|
Scott Ullrich
|
|
74 |
|
|
$pconfig['username'] = $config['pppoe']['username'];
|
75 |
|
|
$pconfig['password'] = $config['pppoe']['password'];
|
76 |
|
|
$pconfig['provider'] = $config['pppoe']['provider'];
|
77 |
a23d7248
|
Scott Ullrich
|
$pconfig['pppoe_dialondemand'] = isset($config['pppoe']['ondemand']);
|
78 |
5b237745
|
Scott Ullrich
|
$pconfig['pppoe_idletimeout'] = $config['pppoe']['timeout'];
|
79 |
|
|
|
80 |
58af5941
|
Scott Ullrich
|
/* ================================================ */
|
81 |
|
|
/* = force a connection reset at a specific time? = */
|
82 |
|
|
/* ================================================ */
|
83 |
|
|
|
84 |
|
|
if (isset($wancfg['pppoe']['pppoe-reset-type'])) {
|
85 |
|
|
$resetTime = getMPDResetTimeFromConfig();
|
86 |
|
|
$pconfig['pppoe_preset'] = true;
|
87 |
|
|
|
88 |
|
|
if ($wancfg['pppoe']['pppoe-reset-type'] == "custom") {
|
89 |
|
|
$resetTime_a = split(" ", $resetTime);
|
90 |
|
|
$pconfig['pppoe_pr_custom'] = true;
|
91 |
|
|
$pconfig['pppoe_resetminute'] = $resetTime_a[0];
|
92 |
|
|
$pconfig['pppoe_resethour'] = $resetTime_a[1];
|
93 |
|
|
|
94 |
|
|
/* just initialize $pconfig['pppoe_resetdate'] if the
|
95 |
|
|
* coresponding item contains appropriate numeric values.
|
96 |
|
|
*/
|
97 |
|
|
if ($resetTime_a[2] <> "*" && $resetTime_a[3] <> "*") {
|
98 |
|
|
$pconfig['pppoe_resetdate'] = "{$resetTime_a[3]}/{$resetTime_a[2]}/" . date("Y");
|
99 |
|
|
}
|
100 |
|
|
} else if ($wancfg['pppoe']['pppoe-reset-type'] == "preset") {
|
101 |
|
|
$pconfig['pppoe_pr_preset'] = true;
|
102 |
|
|
|
103 |
|
|
switch ($resetTime) {
|
104 |
|
|
case CRON_MONTHLY_PATTERN:
|
105 |
|
|
$pconfig['pppoe_monthly'] = true;
|
106 |
|
|
break;
|
107 |
|
|
case CRON_WEEKLY_PATTERN:
|
108 |
|
|
$pconfig['pppoe_weekly'] = true;
|
109 |
|
|
break;
|
110 |
|
|
case CRON_DAILY_PATTERN:
|
111 |
|
|
$pconfig['pppoe_daily'] = true;
|
112 |
|
|
break;
|
113 |
|
|
case CRON_HOURLY_PATTERN:
|
114 |
|
|
$pconfig['pppoe_hourly'] = true;
|
115 |
|
|
break;
|
116 |
|
|
}
|
117 |
|
|
}
|
118 |
|
|
}
|
119 |
|
|
|
120 |
5b237745
|
Scott Ullrich
|
$pconfig['pptp_username'] = $config['pptp']['username'];
|
121 |
|
|
$pconfig['pptp_password'] = $config['pptp']['password'];
|
122 |
|
|
$pconfig['pptp_local'] = $config['pptp']['local'];
|
123 |
|
|
$pconfig['pptp_subnet'] = $config['pptp']['subnet'];
|
124 |
|
|
$pconfig['pptp_remote'] = $config['pptp']['remote'];
|
125 |
a23d7248
|
Scott Ullrich
|
$pconfig['pptp_dialondemand'] = isset($config['pptp']['ondemand']);
|
126 |
5b237745
|
Scott Ullrich
|
$pconfig['pptp_idletimeout'] = $config['pptp']['timeout'];
|
127 |
|
|
|
128 |
c1ec2c2f
|
Scott Ullrich
|
$pconfig['disableftpproxy'] = isset($wancfg['disableftpproxy']);
|
129 |
|
|
|
130 |
5b237745
|
Scott Ullrich
|
$pconfig['dhcphostname'] = $wancfg['dhcphostname'];
|
131 |
|
|
|
132 |
|
|
if ($wancfg['ipaddr'] == "dhcp") {
|
133 |
|
|
$pconfig['type'] = "DHCP";
|
134 |
|
|
} else if ($wancfg['ipaddr'] == "pppoe") {
|
135 |
|
|
$pconfig['type'] = "PPPoE";
|
136 |
|
|
} else if ($wancfg['ipaddr'] == "pptp") {
|
137 |
|
|
$pconfig['type'] = "PPTP";
|
138 |
|
|
} else {
|
139 |
|
|
$pconfig['type'] = "Static";
|
140 |
|
|
$pconfig['ipaddr'] = $wancfg['ipaddr'];
|
141 |
|
|
$pconfig['subnet'] = $wancfg['subnet'];
|
142 |
588a183b
|
Scott Ullrich
|
$pconfig['gateway'] = $config['interfaces']['wan']['gateway'];
|
143 |
a23d7248
|
Scott Ullrich
|
$pconfig['pointtopoint'] = $wancfg['pointtopoint'];
|
144 |
5b237745
|
Scott Ullrich
|
}
|
145 |
|
|
|
146 |
|
|
$pconfig['blockpriv'] = isset($wancfg['blockpriv']);
|
147 |
ff1955ee
|
Bill Marquette
|
$pconfig['blockbogons'] = isset($wancfg['blockbogons']);
|
148 |
5b237745
|
Scott Ullrich
|
$pconfig['spoofmac'] = $wancfg['spoofmac'];
|
149 |
|
|
$pconfig['mtu'] = $wancfg['mtu'];
|
150 |
|
|
|
151 |
|
|
/* Wireless interface? */
|
152 |
b7f01f59
|
Bill Marquette
|
if (isset($wancfg['wireless'])) {
|
153 |
5b237745
|
Scott Ullrich
|
require("interfaces_wlan.inc");
|
154 |
|
|
wireless_config_init();
|
155 |
|
|
}
|
156 |
|
|
|
157 |
|
|
if ($_POST) {
|
158 |
|
|
|
159 |
|
|
unset($input_errors);
|
160 |
|
|
$pconfig = $_POST;
|
161 |
58af5941
|
Scott Ullrich
|
|
162 |
|
|
/* okay first of all, cause we are just hidding the PPPoE HTML
|
163 |
|
|
* fields releated to PPPoE resets, we are going to unset $_POST
|
164 |
|
|
* vars, if the reset feature should not be used. Otherwise the
|
165 |
|
|
* data validation procedure below, may trigger a false error
|
166 |
|
|
* message.
|
167 |
|
|
*/
|
168 |
|
|
if (empty($_POST['pppoe_preset'])) {
|
169 |
|
|
unset($_POST['pppoe_pr_type']);
|
170 |
|
|
unset($_POST['pppoe_resethour']);
|
171 |
|
|
unset($_POST['pppoe_resetminute']);
|
172 |
|
|
unset($_POST['pppoe_resetdate']);
|
173 |
|
|
unset($_POST['pppoe_pr_preset_val']);
|
174 |
|
|
unlink_if_exists(CRON_PPPOE_CMD_FILE);
|
175 |
|
|
}
|
176 |
5b237745
|
Scott Ullrich
|
|
177 |
ee968e4f
|
Scott Ullrich
|
if($_POST['gateway'] and $pconfig['gateway'] <> $_POST['gateway']) {
|
178 |
6fc5bf35
|
Scott Ullrich
|
/* enumerate slbd gateways and make sure we are not creating a route loop */
|
179 |
|
|
if(is_array($config['load_balancer']['lbpool'])) {
|
180 |
|
|
foreach($config['load_balancer']['lbpool'] as $lbpool) {
|
181 |
|
|
if($lbpool['type'] == "gateway") {
|
182 |
|
|
foreach ((array) $lbpool['servers'] as $server) {
|
183 |
|
|
$svr = split("\|", $server);
|
184 |
8bddc5b7
|
Scott Ullrich
|
if($svr[1] == $pconfig['gateway']) {
|
185 |
|
|
$_POST['gateway'] = $pconfig['gateway'];
|
186 |
de42a08e
|
Scott Ullrich
|
$input_errors[] = "Cannot change {$svr[1]} gateway. It is currently referenced by the load balancer pools.";
|
187 |
8bddc5b7
|
Scott Ullrich
|
}
|
188 |
6fc5bf35
|
Scott Ullrich
|
}
|
189 |
|
|
}
|
190 |
8bddc5b7
|
Scott Ullrich
|
}
|
191 |
|
|
foreach($config['filter']['rule'] as $rule) {
|
192 |
|
|
if($rule['gateway'] == $pconfig['gateway']) {
|
193 |
|
|
$_POST['gateway'] = $pconfig['gateway'];
|
194 |
|
|
$input_errors[] = "Cannot change {$svr[1]} gateway. It is currently referenced by the filter rules via policy based routing.";
|
195 |
|
|
}
|
196 |
|
|
}
|
197 |
6fc5bf35
|
Scott Ullrich
|
}
|
198 |
|
|
}
|
199 |
|
|
|
200 |
5b237745
|
Scott Ullrich
|
/* input validation */
|
201 |
|
|
if ($_POST['type'] == "Static") {
|
202 |
|
|
$reqdfields = explode(" ", "ipaddr subnet gateway");
|
203 |
|
|
$reqdfieldsn = explode(",", "IP address,Subnet bit count,Gateway");
|
204 |
|
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
205 |
|
|
} else if ($_POST['type'] == "PPPoE") {
|
206 |
|
|
if ($_POST['pppoe_dialondemand']) {
|
207 |
|
|
$reqdfields = explode(" ", "username password pppoe_dialondemand pppoe_idletimeout");
|
208 |
|
|
$reqdfieldsn = explode(",", "PPPoE username,PPPoE password,Dial on demand,Idle timeout value");
|
209 |
|
|
} else {
|
210 |
|
|
$reqdfields = explode(" ", "username password");
|
211 |
|
|
$reqdfieldsn = explode(",", "PPPoE username,PPPoE password");
|
212 |
|
|
}
|
213 |
|
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
214 |
|
|
} else if ($_POST['type'] == "PPTP") {
|
215 |
|
|
if ($_POST['pptp_dialondemand']) {
|
216 |
|
|
$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote pptp_dialondemand pptp_idletimeout");
|
217 |
|
|
$reqdfieldsn = explode(",", "PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address,Dial on demand,Idle timeout value");
|
218 |
|
|
} else {
|
219 |
|
|
$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote");
|
220 |
|
|
$reqdfieldsn = explode(",", "PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address");
|
221 |
|
|
}
|
222 |
|
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
223 |
9575504e
|
Scott Ullrich
|
}
|
224 |
e2cd32df
|
Scott Ullrich
|
|
225 |
9575504e
|
Scott Ullrich
|
/* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */
|
226 |
|
|
$_POST['spoofmac'] = strtolower(str_replace("-", ":", $_POST['spoofmac']));
|
227 |
4f3401e0
|
Bill Marquette
|
|
228 |
5b237745
|
Scott Ullrich
|
if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) {
|
229 |
|
|
$input_errors[] = "A valid IP address must be specified.";
|
230 |
|
|
}
|
231 |
|
|
if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) {
|
232 |
|
|
$input_errors[] = "A valid subnet bit count must be specified.";
|
233 |
|
|
}
|
234 |
|
|
if (($_POST['gateway'] && !is_ipaddr($_POST['gateway']))) {
|
235 |
|
|
$input_errors[] = "A valid gateway must be specified.";
|
236 |
|
|
}
|
237 |
a23d7248
|
Scott Ullrich
|
if (($_POST['pointtopoint'] && !is_ipaddr($_POST['pointtopoint']))) {
|
238 |
|
|
$input_errors[] = "A valid point-to-point IP address must be specified.";
|
239 |
|
|
}
|
240 |
5b237745
|
Scott Ullrich
|
if (($_POST['provider'] && !is_domain($_POST['provider']))) {
|
241 |
|
|
$input_errors[] = "The service name contains invalid characters.";
|
242 |
|
|
}
|
243 |
a23d7248
|
Scott Ullrich
|
if (($_POST['pppoe_idletimeout'] != "") && !is_numericint($_POST['pppoe_idletimeout'])) {
|
244 |
5b237745
|
Scott Ullrich
|
$input_errors[] = "The idle timeout value must be an integer.";
|
245 |
|
|
}
|
246 |
58af5941
|
Scott Ullrich
|
if ($_POST['pppoe_resethour'] <> "" &&
|
247 |
|
|
!is_numericint($_POST['pppoe_resethour']) &&
|
248 |
|
|
$_POST['pppoe_resethour'] >= 0 &&
|
249 |
|
|
$_POST['pppoe_resethour'] <=23) {
|
250 |
|
|
$input_errors[] = gettext("A valid PPPoE reset hour must be specified (0-23).");
|
251 |
|
|
}
|
252 |
|
|
if ($_POST['pppoe_resetminute'] <> "" &&
|
253 |
|
|
!is_numericint($_POST['pppoe_resetminute']) &&
|
254 |
|
|
$_POST['pppoe_resetminute'] >= 0 &&
|
255 |
|
|
$_POST['pppoe_resetminute'] <=59) {
|
256 |
|
|
$input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59).");
|
257 |
|
|
}
|
258 |
|
|
if ($_POST['pppoe_resetdate'] <> "" && !is_numeric(str_replace("/", "", $_POST['pppoe_resetdate']))) {
|
259 |
|
|
$input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy).");
|
260 |
|
|
}
|
261 |
5b237745
|
Scott Ullrich
|
if (($_POST['pptp_local'] && !is_ipaddr($_POST['pptp_local']))) {
|
262 |
|
|
$input_errors[] = "A valid PPTP local IP address must be specified.";
|
263 |
|
|
}
|
264 |
|
|
if (($_POST['pptp_subnet'] && !is_numeric($_POST['pptp_subnet']))) {
|
265 |
|
|
$input_errors[] = "A valid PPTP subnet bit count must be specified.";
|
266 |
|
|
}
|
267 |
|
|
if (($_POST['pptp_remote'] && !is_ipaddr($_POST['pptp_remote']))) {
|
268 |
|
|
$input_errors[] = "A valid PPTP remote IP address must be specified.";
|
269 |
|
|
}
|
270 |
a23d7248
|
Scott Ullrich
|
if (($_POST['pptp_idletimeout'] != "") && !is_numericint($_POST['pptp_idletimeout'])) {
|
271 |
5b237745
|
Scott Ullrich
|
$input_errors[] = "The idle timeout value must be an integer.";
|
272 |
|
|
}
|
273 |
|
|
if (($_POST['spoofmac'] && !is_macaddr($_POST['spoofmac']))) {
|
274 |
|
|
$input_errors[] = "A valid MAC address must be specified.";
|
275 |
|
|
}
|
276 |
|
|
if ($_POST['mtu'] && (($_POST['mtu'] < 576) || ($_POST['mtu'] > 1500))) {
|
277 |
|
|
$input_errors[] = "The MTU must be between 576 and 1500 bytes.";
|
278 |
|
|
}
|
279 |
e2cd32df
|
Scott Ullrich
|
|
280 |
5b237745
|
Scott Ullrich
|
/* Wireless interface? */
|
281 |
b7f01f59
|
Bill Marquette
|
if (isset($wancfg['wireless'])) {
|
282 |
5b237745
|
Scott Ullrich
|
$wi_input_errors = wireless_config_post();
|
283 |
|
|
if ($wi_input_errors) {
|
284 |
|
|
$input_errors = array_merge($input_errors, $wi_input_errors);
|
285 |
|
|
}
|
286 |
|
|
}
|
287 |
|
|
|
288 |
|
|
if (!$input_errors) {
|
289 |
e2cd32df
|
Scott Ullrich
|
|
290 |
9a6757a1
|
Scott Ullrich
|
$bridge = discover_bridge($wancfg['if'], filter_translate_type_to_real_interface($wancfg['bridge']));
|
291 |
0d429e43
|
Scott Ullrich
|
if($bridge <> "-1") {
|
292 |
1665e79c
|
Scott Ullrich
|
destroy_bridge($bridge);
|
293 |
638adc34
|
Chris Buechler
|
setup_bridge();
|
294 |
91e8aab2
|
Scott Ullrich
|
}
|
295 |
b1c525ee
|
Scott Ullrich
|
|
296 |
5b237745
|
Scott Ullrich
|
unset($wancfg['ipaddr']);
|
297 |
|
|
unset($wancfg['subnet']);
|
298 |
588a183b
|
Scott Ullrich
|
unset($config['interfaces']['wan']['gateway']);
|
299 |
a23d7248
|
Scott Ullrich
|
unset($wancfg['pointtopoint']);
|
300 |
5b237745
|
Scott Ullrich
|
unset($wancfg['dhcphostname']);
|
301 |
58af5941
|
Scott Ullrich
|
if (is_array($wancfg['pppoe'])) {
|
302 |
|
|
unset($config['pppoe']['username']);
|
303 |
|
|
unset($config['pppoe']['password']);
|
304 |
|
|
unset($config['pppoe']['provider']);
|
305 |
|
|
unset($config['pppoe']['ondemand']);
|
306 |
|
|
unset($config['pppoe']['timeout']);
|
307 |
|
|
unset($wancfg['pppoe']['pppoe-reset-type']);
|
308 |
|
|
}
|
309 |
|
|
if (is_array($wancfg['pptp'])) {
|
310 |
|
|
unset($config['pptp']['username']);
|
311 |
|
|
unset($config['pptp']['password']);
|
312 |
|
|
unset($config['pptp']['local']);
|
313 |
|
|
unset($config['pptp']['subnet']);
|
314 |
|
|
unset($config['pptp']['remote']);
|
315 |
|
|
unset($config['pptp']['ondemand']);
|
316 |
|
|
unset($config['pptp']['timeout']);
|
317 |
|
|
}
|
318 |
9575504e
|
Scott Ullrich
|
|
319 |
|
|
unset($wancfg['disableftpproxy']);
|
320 |
b1c525ee
|
Scott Ullrich
|
|
321 |
c1ec2c2f
|
Scott Ullrich
|
/* per interface pftpx helper */
|
322 |
|
|
if($_POST['disableftpproxy'] == "yes") {
|
323 |
|
|
$wancfg['disableftpproxy'] = true;
|
324 |
|
|
system_start_ftp_helpers();
|
325 |
b1c525ee
|
Scott Ullrich
|
} else {
|
326 |
c1ec2c2f
|
Scott Ullrich
|
system_start_ftp_helpers();
|
327 |
|
|
}
|
328 |
e2cd32df
|
Scott Ullrich
|
|
329 |
5b237745
|
Scott Ullrich
|
if ($_POST['type'] == "Static") {
|
330 |
|
|
$wancfg['ipaddr'] = $_POST['ipaddr'];
|
331 |
|
|
$wancfg['subnet'] = $_POST['subnet'];
|
332 |
588a183b
|
Scott Ullrich
|
$config['interfaces']['wan']['gateway'] = $_POST['gateway'];
|
333 |
a23d7248
|
Scott Ullrich
|
if (isset($wancfg['ispointtopoint']))
|
334 |
|
|
$wancfg['pointtopoint'] = $_POST['pointtopoint'];
|
335 |
5b237745
|
Scott Ullrich
|
} else if ($_POST['type'] == "DHCP") {
|
336 |
|
|
$wancfg['ipaddr'] = "dhcp";
|
337 |
|
|
$wancfg['dhcphostname'] = $_POST['dhcphostname'];
|
338 |
|
|
} else if ($_POST['type'] == "PPPoE") {
|
339 |
|
|
$wancfg['ipaddr'] = "pppoe";
|
340 |
|
|
$config['pppoe']['username'] = $_POST['username'];
|
341 |
|
|
$config['pppoe']['password'] = $_POST['password'];
|
342 |
|
|
$config['pppoe']['provider'] = $_POST['provider'];
|
343 |
a23d7248
|
Scott Ullrich
|
$config['pppoe']['ondemand'] = $_POST['pppoe_dialondemand'] ? true : false;
|
344 |
5b237745
|
Scott Ullrich
|
$config['pppoe']['timeout'] = $_POST['pppoe_idletimeout'];
|
345 |
58af5941
|
Scott Ullrich
|
|
346 |
|
|
/* perform a periodic reset? */
|
347 |
|
|
if (isset($_POST['pppoe_preset'])) {
|
348 |
|
|
if (! is_array($config['cron']['item'])) { $config['cron']['item'] = array(); }
|
349 |
|
|
|
350 |
|
|
$itemhash = getMPDCRONSettings();
|
351 |
|
|
$item = $itemhash['ITEM'];
|
352 |
|
|
|
353 |
|
|
if (empty($item)) {
|
354 |
|
|
$item = array();
|
355 |
|
|
}
|
356 |
|
|
|
357 |
|
|
if (isset($_POST['pppoe_pr_type']) && $_POST['pppoe_pr_type'] == "custom") {
|
358 |
|
|
$wancfg['pppoe']['pppoe-reset-type'] = "custom";
|
359 |
|
|
$pconfig['pppoe_pr_custom'] = true;
|
360 |
|
|
|
361 |
|
|
$item['minute'] = $_POST['pppoe_resetminute'];
|
362 |
|
|
$item['hour'] = $_POST['pppoe_resethour'];
|
363 |
|
|
|
364 |
|
|
if (isset($_POST['pppoe_resetdate']) &&
|
365 |
|
|
$_POST['pppoe_resetdate'] <> "" &&
|
366 |
|
|
strlen($_POST['pppoe_resetdate']) == 10) {
|
367 |
|
|
$date = explode("/", $_POST['pppoe_resetdate']);
|
368 |
|
|
|
369 |
|
|
$item['mday'] = $date[1];
|
370 |
|
|
$item['month'] = $date[0];
|
371 |
|
|
} else {
|
372 |
|
|
$item['mday'] = "*";
|
373 |
|
|
$item['month'] = "*";
|
374 |
|
|
}
|
375 |
|
|
|
376 |
|
|
$item['wday'] = "*";
|
377 |
|
|
$item['who'] = "root";
|
378 |
|
|
$item['command'] = CRON_PPPOE_CMD_FILE;
|
379 |
|
|
} else if (isset($_POST['pppoe_pr_type']) && $_POST['pppoe_pr_type'] = "preset") {
|
380 |
|
|
$wancfg['pppoe']['pppoe-reset-type'] = "preset";
|
381 |
|
|
$pconfig['pppoe_pr_preset'] = true;
|
382 |
|
|
|
383 |
|
|
switch ($_POST['pppoe_pr_preset_val']) {
|
384 |
|
|
case "monthly":
|
385 |
|
|
$item['minute'] = "0";
|
386 |
|
|
$item['hour'] = "0";
|
387 |
|
|
$item['mday'] = "1";
|
388 |
|
|
$item['month'] = "*";
|
389 |
|
|
$item['wday'] = "*";
|
390 |
|
|
$item['who'] = "root";
|
391 |
|
|
$item['command'] = CRON_PPPOE_CMD_FILE;
|
392 |
|
|
break;
|
393 |
|
|
case "weekly":
|
394 |
|
|
$item['minute'] = "0";
|
395 |
|
|
$item['hour'] = "0";
|
396 |
|
|
$item['mday'] = "*";
|
397 |
|
|
$item['month'] = "*";
|
398 |
|
|
$item['wday'] = "0";
|
399 |
|
|
$item['who'] = "root";
|
400 |
|
|
$item['command'] = CRON_PPPOE_CMD_FILE;
|
401 |
|
|
break;
|
402 |
|
|
case "daily":
|
403 |
|
|
$item['minute'] = "0";
|
404 |
|
|
$item['hour'] = "0";
|
405 |
|
|
$item['mday'] = "*";
|
406 |
|
|
$item['month'] = "*";
|
407 |
|
|
$item['wday'] = "*";
|
408 |
|
|
$item['who'] = "root";
|
409 |
|
|
$item['command'] = CRON_PPPOE_CMD_FILE;
|
410 |
|
|
break;
|
411 |
|
|
case "hourly":
|
412 |
|
|
$item['minute'] = "0";
|
413 |
|
|
$item['hour'] = "*";
|
414 |
|
|
$item['mday'] = "*";
|
415 |
|
|
$item['month'] = "*";
|
416 |
|
|
$item['wday'] = "*";
|
417 |
|
|
$item['who'] = "root";
|
418 |
|
|
$item['command'] = CRON_PPPOE_CMD_FILE;
|
419 |
|
|
break;
|
420 |
|
|
} // end switch
|
421 |
|
|
} // end if
|
422 |
|
|
|
423 |
|
|
if (isset($itemhash['ID'])) {
|
424 |
|
|
$config['cron']['item'][$itemhash['ID']] = $item;
|
425 |
|
|
} else {
|
426 |
|
|
$config['cron']['item'][] = $item;
|
427 |
|
|
}
|
428 |
|
|
} // end if
|
429 |
5b237745
|
Scott Ullrich
|
} else if ($_POST['type'] == "PPTP") {
|
430 |
|
|
$wancfg['ipaddr'] = "pptp";
|
431 |
|
|
$config['pptp']['username'] = $_POST['pptp_username'];
|
432 |
|
|
$config['pptp']['password'] = $_POST['pptp_password'];
|
433 |
|
|
$config['pptp']['local'] = $_POST['pptp_local'];
|
434 |
|
|
$config['pptp']['subnet'] = $_POST['pptp_subnet'];
|
435 |
|
|
$config['pptp']['remote'] = $_POST['pptp_remote'];
|
436 |
a23d7248
|
Scott Ullrich
|
$config['pptp']['ondemand'] = $_POST['pptp_dialondemand'] ? true : false;
|
437 |
5b237745
|
Scott Ullrich
|
$config['pptp']['timeout'] = $_POST['pptp_idletimeout'];
|
438 |
|
|
}
|
439 |
58af5941
|
Scott Ullrich
|
|
440 |
|
|
/* reset cron items if necessary */
|
441 |
|
|
if (empty($_POST['pppoe_preset'])) {
|
442 |
|
|
/* test whether a cron item exists and unset() it if necessary */
|
443 |
|
|
$itemhash = getMPDCRONSettings();
|
444 |
|
|
$item = $itemhash['ITEM'];
|
445 |
|
|
|
446 |
|
|
if (isset($item)) { unset($config['cron']['item'][$itemhash['ID']]); }
|
447 |
|
|
}
|
448 |
e2cd32df
|
Scott Ullrich
|
|
449 |
90ebf755
|
Scott Ullrich
|
if($_POST['blockpriv'] == "yes")
|
450 |
|
|
$wancfg['blockpriv'] = true;
|
451 |
|
|
else
|
452 |
42a58cb9
|
Scott Ullrich
|
unset($wancfg['blockpriv']);
|
453 |
b1c525ee
|
Scott Ullrich
|
|
454 |
90ebf755
|
Scott Ullrich
|
if($_POST['blockbogons'] == "yes")
|
455 |
|
|
$wancfg['blockbogons'] = true;
|
456 |
|
|
else
|
457 |
|
|
unset($wancfg['blockbogons']);
|
458 |
b1c525ee
|
Scott Ullrich
|
|
459 |
5b237745
|
Scott Ullrich
|
$wancfg['spoofmac'] = $_POST['spoofmac'];
|
460 |
|
|
$wancfg['mtu'] = $_POST['mtu'];
|
461 |
e2cd32df
|
Scott Ullrich
|
|
462 |
5b237745
|
Scott Ullrich
|
write_config();
|
463 |
58af5941
|
Scott Ullrich
|
|
464 |
|
|
/* finally install the pppoerestart file */
|
465 |
|
|
if (isset($_POST['pppoe_preset'])) {
|
466 |
|
|
config_lock();
|
467 |
|
|
conf_mount_rw();
|
468 |
|
|
|
469 |
|
|
if (! file_exists(CRON_PPPOE_CMD_FILE)) {
|
470 |
|
|
file_put_contents(CRON_PPPOE_CMD_FILE, CRON_PPPOE_CMD);
|
471 |
|
|
chmod(CRON_PPPOE_CMD_FILE, 0700);
|
472 |
|
|
}
|
473 |
|
|
|
474 |
|
|
/* regenerate cron settings/crontab file */
|
475 |
|
|
configure_cron();
|
476 |
|
|
sigkillbypid("{$g['varrun_path']}/cron.pid", "HUP");
|
477 |
|
|
|
478 |
|
|
conf_mount_ro();
|
479 |
|
|
config_unlock();
|
480 |
|
|
}
|
481 |
e2cd32df
|
Scott Ullrich
|
|
482 |
276a350f
|
Scott Ullrich
|
|
483 |
5b237745
|
Scott Ullrich
|
$retval = 0;
|
484 |
11a4b1a0
|
Scott Ullrich
|
|
485 |
824edb6c
|
Scott Ullrich
|
$savemsg = get_std_save_message($retval);
|
486 |
5b237745
|
Scott Ullrich
|
}
|
487 |
|
|
}
|
488 |
7f43ca88
|
Scott Ullrich
|
|
489 |
|
|
$pgtitle = "Interfaces: WAN";
|
490 |
58af5941
|
Scott Ullrich
|
$closehead = false;
|
491 |
7f43ca88
|
Scott Ullrich
|
include("head.inc");
|
492 |
|
|
|
493 |
5b237745
|
Scott Ullrich
|
?>
|
494 |
7f43ca88
|
Scott Ullrich
|
|
495 |
58af5941
|
Scott Ullrich
|
<script type="text/javascript" src="/javascript/numericupdown/js/numericupdown.js"></script>
|
496 |
|
|
<link href="/javascript/numericupdown/css/numericupdown.css" rel="stylesheet" type="text/css" />
|
497 |
|
|
|
498 |
|
|
<script type="text/javascript" src="/javascript/datepicker/js/datepicker.js"></script>
|
499 |
|
|
<link href="/javascript/datepicker/css/datepicker.css" rel="stylesheet" type="text/css" />
|
500 |
|
|
|
501 |
|
|
<script type="text/javascript" src="/javascript/scriptaculous/prototype.js"></script>
|
502 |
|
|
<script type="text/javascript" src="/javascript/scriptaculous/scriptaculous.js"></script>
|
503 |
|
|
|
504 |
|
|
<script type="text/javascript">
|
505 |
5b237745
|
Scott Ullrich
|
<!--
|
506 |
|
|
function enable_change(enable_change) {
|
507 |
|
|
if (document.iform.pppoe_dialondemand.checked || enable_change) {
|
508 |
|
|
document.iform.pppoe_idletimeout.disabled = 0;
|
509 |
|
|
} else {
|
510 |
|
|
document.iform.pppoe_idletimeout.disabled = 1;
|
511 |
|
|
}
|
512 |
|
|
}
|
513 |
|
|
|
514 |
|
|
function enable_change_pptp(enable_change_pptp) {
|
515 |
|
|
if (document.iform.pptp_dialondemand.checked || enable_change_pptp) {
|
516 |
|
|
document.iform.pptp_idletimeout.disabled = 0;
|
517 |
|
|
document.iform.pptp_local.disabled = 0;
|
518 |
|
|
document.iform.pptp_remote.disabled = 0;
|
519 |
|
|
} else {
|
520 |
|
|
document.iform.pptp_idletimeout.disabled = 1;
|
521 |
|
|
}
|
522 |
|
|
}
|
523 |
|
|
|
524 |
|
|
function type_change(enable_change,enable_change_pptp) {
|
525 |
|
|
switch (document.iform.type.selectedIndex) {
|
526 |
|
|
case 0:
|
527 |
|
|
document.iform.username.disabled = 1;
|
528 |
|
|
document.iform.password.disabled = 1;
|
529 |
|
|
document.iform.provider.disabled = 1;
|
530 |
|
|
document.iform.pppoe_dialondemand.disabled = 1;
|
531 |
|
|
document.iform.pppoe_idletimeout.disabled = 1;
|
532 |
9575504e
|
Scott Ullrich
|
document.iform.pppoe_preset.disabled = 1;
|
533 |
|
|
document.iform.pppoe_preset.checked = 0;
|
534 |
|
|
Effect.Fade('presetwrap', { duration: 1.0 });
|
535 |
5b237745
|
Scott Ullrich
|
document.iform.ipaddr.disabled = 0;
|
536 |
|
|
document.iform.subnet.disabled = 0;
|
537 |
|
|
document.iform.gateway.disabled = 0;
|
538 |
|
|
document.iform.pptp_username.disabled = 1;
|
539 |
|
|
document.iform.pptp_password.disabled = 1;
|
540 |
|
|
document.iform.pptp_local.disabled = 1;
|
541 |
|
|
document.iform.pptp_subnet.disabled = 1;
|
542 |
|
|
document.iform.pptp_remote.disabled = 1;
|
543 |
|
|
document.iform.pptp_dialondemand.disabled = 1;
|
544 |
|
|
document.iform.pptp_idletimeout.disabled = 1;
|
545 |
|
|
document.iform.dhcphostname.disabled = 1;
|
546 |
|
|
break;
|
547 |
|
|
case 1:
|
548 |
|
|
document.iform.username.disabled = 1;
|
549 |
|
|
document.iform.password.disabled = 1;
|
550 |
|
|
document.iform.provider.disabled = 1;
|
551 |
|
|
document.iform.pppoe_dialondemand.disabled = 1;
|
552 |
|
|
document.iform.pppoe_idletimeout.disabled = 1;
|
553 |
9575504e
|
Scott Ullrich
|
document.iform.pppoe_preset.disabled = 1;
|
554 |
|
|
document.iform.pppoe_preset.checked = 0;
|
555 |
|
|
Effect.Fade('presetwrap', { duration: 1.0 });
|
556 |
5b237745
|
Scott Ullrich
|
document.iform.ipaddr.disabled = 1;
|
557 |
|
|
document.iform.subnet.disabled = 1;
|
558 |
|
|
document.iform.gateway.disabled = 1;
|
559 |
|
|
document.iform.pptp_username.disabled = 1;
|
560 |
|
|
document.iform.pptp_password.disabled = 1;
|
561 |
|
|
document.iform.pptp_local.disabled = 1;
|
562 |
|
|
document.iform.pptp_subnet.disabled = 1;
|
563 |
|
|
document.iform.pptp_remote.disabled = 1;
|
564 |
|
|
document.iform.pptp_dialondemand.disabled = 1;
|
565 |
|
|
document.iform.pptp_idletimeout.disabled = 1;
|
566 |
|
|
document.iform.dhcphostname.disabled = 0;
|
567 |
|
|
break;
|
568 |
|
|
case 2:
|
569 |
|
|
document.iform.username.disabled = 0;
|
570 |
|
|
document.iform.password.disabled = 0;
|
571 |
|
|
document.iform.provider.disabled = 0;
|
572 |
|
|
document.iform.pppoe_dialondemand.disabled = 0;
|
573 |
|
|
if (document.iform.pppoe_dialondemand.checked || enable_change) {
|
574 |
|
|
document.iform.pppoe_idletimeout.disabled = 0;
|
575 |
|
|
} else {
|
576 |
|
|
document.iform.pppoe_idletimeout.disabled = 1;
|
577 |
|
|
}
|
578 |
58af5941
|
Scott Ullrich
|
document.iform.pppoe_preset.disabled = 0;
|
579 |
5b237745
|
Scott Ullrich
|
document.iform.ipaddr.disabled = 1;
|
580 |
|
|
document.iform.subnet.disabled = 1;
|
581 |
|
|
document.iform.gateway.disabled = 1;
|
582 |
|
|
document.iform.pptp_username.disabled = 1;
|
583 |
|
|
document.iform.pptp_password.disabled = 1;
|
584 |
|
|
document.iform.pptp_local.disabled = 1;
|
585 |
|
|
document.iform.pptp_subnet.disabled = 1;
|
586 |
|
|
document.iform.pptp_remote.disabled = 1;
|
587 |
|
|
document.iform.pptp_dialondemand.disabled = 1;
|
588 |
|
|
document.iform.pptp_idletimeout.disabled = 1;
|
589 |
|
|
document.iform.dhcphostname.disabled = 1;
|
590 |
|
|
break;
|
591 |
|
|
case 3:
|
592 |
|
|
document.iform.username.disabled = 1;
|
593 |
|
|
document.iform.password.disabled = 1;
|
594 |
|
|
document.iform.provider.disabled = 1;
|
595 |
|
|
document.iform.pppoe_dialondemand.disabled = 1;
|
596 |
|
|
document.iform.pppoe_idletimeout.disabled = 1;
|
597 |
9575504e
|
Scott Ullrich
|
document.iform.pppoe_preset.disabled = 1;
|
598 |
|
|
document.iform.pppoe_preset.checked = 0;
|
599 |
|
|
Effect.Fade('presetwrap', { duration: 1.0 });
|
600 |
5b237745
|
Scott Ullrich
|
document.iform.ipaddr.disabled = 1;
|
601 |
|
|
document.iform.subnet.disabled = 1;
|
602 |
|
|
document.iform.gateway.disabled = 1;
|
603 |
|
|
document.iform.pptp_username.disabled = 0;
|
604 |
|
|
document.iform.pptp_password.disabled = 0;
|
605 |
|
|
document.iform.pptp_local.disabled = 0;
|
606 |
|
|
document.iform.pptp_subnet.disabled = 0;
|
607 |
|
|
document.iform.pptp_remote.disabled = 0;
|
608 |
|
|
document.iform.pptp_dialondemand.disabled = 0;
|
609 |
|
|
if (document.iform.pptp_dialondemand.checked || enable_change_pptp) {
|
610 |
|
|
document.iform.pptp_idletimeout.disabled = 0;
|
611 |
|
|
} else {
|
612 |
|
|
document.iform.pptp_idletimeout.disabled = 1;
|
613 |
|
|
}
|
614 |
|
|
document.iform.dhcphostname.disabled = 1;
|
615 |
|
|
break;
|
616 |
|
|
}
|
617 |
|
|
}
|
618 |
|
|
//-->
|
619 |
|
|
</script>
|
620 |
58af5941
|
Scott Ullrich
|
</head>
|
621 |
5b237745
|
Scott Ullrich
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
622 |
|
|
<?php include("fbegin.inc"); ?>
|
623 |
931066a8
|
Bill Marquette
|
<p class="pgtitle"><?=$pgtitle?></p>
|
624 |
5b237745
|
Scott Ullrich
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
625 |
|
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
626 |
|
|
<form action="interfaces_wan.php" method="post" name="iform" id="iform">
|
627 |
|
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
628 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
629 |
8fdc8744
|
Bill Marquette
|
<td colspan="2" valign="top" class="listtopic">General configuration</td>
|
630 |
|
|
</tr>
|
631 |
|
|
<tr>
|
632 |
|
|
<td valign="middle" class="vncell"><strong>Type</strong></td>
|
633 |
|
|
<td class="vtable"> <select name="type" class="formfld" id="type" onchange="type_change()">
|
634 |
9575504e
|
Scott Ullrich
|
<?php $opts = split(" ", "Static DHCP PPPoE PPTP");
|
635 |
5b237745
|
Scott Ullrich
|
foreach ($opts as $opt): ?>
|
636 |
e2cd32df
|
Scott Ullrich
|
<option <?php if ($opt == $pconfig['type']) echo "selected";?>>
|
637 |
5b237745
|
Scott Ullrich
|
<?=htmlspecialchars($opt);?>
|
638 |
|
|
</option>
|
639 |
|
|
<?php endforeach; ?>
|
640 |
|
|
</select></td>
|
641 |
|
|
</tr>
|
642 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
643 |
5b237745
|
Scott Ullrich
|
<td valign="top" class="vncell">MAC address</td>
|
644 |
e2cd32df
|
Scott Ullrich
|
<td class="vtable"> <input name="spoofmac" type="text" class="formfld" id="spoofmac" size="30" value="<?=htmlspecialchars($pconfig['spoofmac']);?>">
|
645 |
1e694bee
|
Scott Ullrich
|
<?php
|
646 |
|
|
$ip = getenv('REMOTE_ADDR');
|
647 |
|
|
$mac = `/usr/sbin/arp -an | grep {$ip} | cut -d" " -f4`;
|
648 |
|
|
$mac = str_replace("\n","",$mac);
|
649 |
|
|
?>
|
650 |
b1c525ee
|
Scott Ullrich
|
<a OnClick="document.forms[0].spoofmac.value='<?=$mac?>';" href="#">Copy my MAC address</a>
|
651 |
1e694bee
|
Scott Ullrich
|
<br>
|
652 |
e2cd32df
|
Scott Ullrich
|
This field can be used to modify ("spoof") the MAC
|
653 |
5b237745
|
Scott Ullrich
|
address of the WAN interface<br>
|
654 |
|
|
(may be required with some cable connections)<br>
|
655 |
e2cd32df
|
Scott Ullrich
|
Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx
|
656 |
5b237745
|
Scott Ullrich
|
or leave blank</td>
|
657 |
|
|
</tr>
|
658 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
659 |
5b237745
|
Scott Ullrich
|
<td valign="top" class="vncell">MTU</td>
|
660 |
e2cd32df
|
Scott Ullrich
|
<td class="vtable"> <input name="mtu" type="text" class="formfld" id="mtu" size="8" value="<?=htmlspecialchars($pconfig['mtu']);?>">
|
661 |
5b237745
|
Scott Ullrich
|
<br>
|
662 |
e2cd32df
|
Scott Ullrich
|
If you enter a value in this field, then MSS clamping for
|
663 |
|
|
TCP connections to the value entered above minus 40 (TCP/IP
|
664 |
|
|
header size) will be in effect. If you leave this field blank,
|
665 |
|
|
an MTU of 1492 bytes for PPPoE and 1500 bytes for all other
|
666 |
5b237745
|
Scott Ullrich
|
connection types will be assumed.</td>
|
667 |
|
|
</tr>
|
668 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
669 |
5b237745
|
Scott Ullrich
|
<td colspan="2" valign="top" height="16"></td>
|
670 |
|
|
</tr>
|
671 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
672 |
a23d7248
|
Scott Ullrich
|
<td colspan="2" valign="top" class="listtopic">Static IP configuration</td>
|
673 |
5b237745
|
Scott Ullrich
|
</tr>
|
674 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
675 |
5b237745
|
Scott Ullrich
|
<td width="100" valign="top" class="vncellreq">IP address</td>
|
676 |
|
|
<td class="vtable"> <input name="ipaddr" type="text" class="formfld" id="ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>">
|
677 |
e2cd32df
|
Scott Ullrich
|
/
|
678 |
5b237745
|
Scott Ullrich
|
<select name="subnet" class="formfld" id="subnet">
|
679 |
fa3b333d
|
Scott Ullrich
|
<?php
|
680 |
|
|
for ($i = 32; $i > 0; $i--) {
|
681 |
|
|
if($i <> 31) {
|
682 |
|
|
echo "<option value=\"{$i}\" ";
|
683 |
|
|
if ($i == $pconfig['subnet']) echo "selected";
|
684 |
|
|
echo ">" . $i . "</option>";
|
685 |
|
|
}
|
686 |
|
|
}
|
687 |
|
|
?>
|
688 |
5b237745
|
Scott Ullrich
|
</select></td>
|
689 |
a23d7248
|
Scott Ullrich
|
</tr><?php if (isset($wancfg['ispointtopoint'])): ?>
|
690 |
7f5b4824
|
Scott Ullrich
|
<tr>
|
691 |
a23d7248
|
Scott Ullrich
|
<td valign="top" class="vncellreq">Point-to-point IP address </td>
|
692 |
|
|
<td class="vtable">
|
693 |
|
|
<input name="pointtopoint" type="text" class="formfld" id="pointtopoint" size="20" value="<?=htmlspecialchars($pconfig['pointtopoint']);?>">
|
694 |
|
|
</td>
|
695 |
|
|
</tr><?php endif; ?>
|
696 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
697 |
5b237745
|
Scott Ullrich
|
<td valign="top" class="vncellreq">Gateway</td>
|
698 |
e2cd32df
|
Scott Ullrich
|
<td class="vtable"> <input name="gateway" type="text" class="formfld" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>">
|
699 |
5b237745
|
Scott Ullrich
|
</td>
|
700 |
|
|
</tr>
|
701 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
702 |
73c38fa2
|
Scott Ullrich
|
<td colspan="2" valign="top" height="16"></td>
|
703 |
|
|
</tr>
|
704 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
705 |
a23d7248
|
Scott Ullrich
|
<td colspan="2" valign="top" class="listtopic">DHCP client configuration</td>
|
706 |
5b237745
|
Scott Ullrich
|
</tr>
|
707 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
708 |
5b237745
|
Scott Ullrich
|
<td valign="top" class="vncell">Hostname</td>
|
709 |
|
|
<td class="vtable"> <input name="dhcphostname" type="text" class="formfld" id="dhcphostname" size="40" value="<?=htmlspecialchars($pconfig['dhcphostname']);?>">
|
710 |
|
|
<br>
|
711 |
e2cd32df
|
Scott Ullrich
|
The value in this field is sent as the DHCP client identifier
|
712 |
|
|
and hostname when requesting a DHCP lease. Some ISPs may require
|
713 |
5b237745
|
Scott Ullrich
|
this (for client identification).</td>
|
714 |
|
|
</tr>
|
715 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
716 |
5b237745
|
Scott Ullrich
|
<td colspan="2" valign="top" height="16"></td>
|
717 |
|
|
</tr>
|
718 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
719 |
a23d7248
|
Scott Ullrich
|
<td colspan="2" valign="top" class="listtopic">PPPoE configuration</td>
|
720 |
5b237745
|
Scott Ullrich
|
</tr>
|
721 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
722 |
5b237745
|
Scott Ullrich
|
<td valign="top" class="vncellreq">Username</td>
|
723 |
e2cd32df
|
Scott Ullrich
|
<td class="vtable"><input name="username" type="text" class="formfld" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>">
|
724 |
5b237745
|
Scott Ullrich
|
</td>
|
725 |
|
|
</tr>
|
726 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
727 |
5b237745
|
Scott Ullrich
|
<td valign="top" class="vncellreq">Password</td>
|
728 |
8ea9996c
|
Scott Ullrich
|
<td class="vtable"><input name="password" type="password" class="formfld" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>">
|
729 |
5b237745
|
Scott Ullrich
|
</td>
|
730 |
|
|
</tr>
|
731 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
732 |
5b237745
|
Scott Ullrich
|
<td valign="top" class="vncell">Service name</td>
|
733 |
e2cd32df
|
Scott Ullrich
|
<td class="vtable"><input name="provider" type="text" class="formfld" id="provider" size="20" value="<?=htmlspecialchars($pconfig['provider']);?>">
|
734 |
|
|
<br> <span class="vexpl">Hint: this field can usually be left
|
735 |
5b237745
|
Scott Ullrich
|
empty</span></td>
|
736 |
|
|
</tr>
|
737 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
738 |
5b237745
|
Scott Ullrich
|
<td valign="top" class="vncell">Dial on demand</td>
|
739 |
e2cd32df
|
Scott Ullrich
|
<td class="vtable"><input name="pppoe_dialondemand" type="checkbox" id="pppoe_dialondemand" value="enable" <?php if ($pconfig['pppoe_dialondemand']) echo "checked"; ?> onClick="enable_change(false)" >
|
740 |
5b237745
|
Scott Ullrich
|
<strong>Enable Dial-On-Demand mode</strong><br>
|
741 |
|
|
This option causes the interface to operate in dial-on-demand mode, allowing you to have a <i>virtual full time</i> connection. The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected.</td>
|
742 |
|
|
</tr>
|
743 |
|
|
<tr>
|
744 |
|
|
<td valign="top" class="vncell">Idle timeout</td>
|
745 |
|
|
<td class="vtable">
|
746 |
fa3b333d
|
Scott Ullrich
|
<input name="pppoe_idletimeout" type="text" class="formfld" id="pppoe_idletimeout" size="8" value="<?=htmlspecialchars($pconfig['pppoe_idletimeout']);?>"> seconds<br>If no qualifying outgoing packets are transmitted for the specified number of seconds, the connection is brought down. An idle timeout of zero disables this feature.</td>
|
747 |
5b237745
|
Scott Ullrich
|
</tr>
|
748 |
58af5941
|
Scott Ullrich
|
<tr>
|
749 |
|
|
<td valign="top" class="vncell"><?=gettext("Periodic reset");?></td>
|
750 |
|
|
<td class="vtable">
|
751 |
|
|
<input name="pppoe_preset" type="checkbox" id="pppoe_preset" value="yes" <?php if ($pconfig['pppoe_preset']) echo "checked=\"checked\""; ?> onclick="Effect.toggle('presetwrap', 'appear', { duration: 1.0 });" />
|
752 |
|
|
<?= gettext("enable periodic PPPoE resets"); ?>
|
753 |
|
|
<br />
|
754 |
|
|
<?php if ($pconfig['pppoe_preset']): ?>
|
755 |
|
|
<table id="presetwrap" cellspacing="0" cellpadding="0" width="100%">
|
756 |
|
|
<?php else: ?>
|
757 |
|
|
<table id="presetwrap" cellspacing="0" cellpadding="0" width="100%" style="display: none;">
|
758 |
|
|
<?php endif; ?>
|
759 |
|
|
<tr>
|
760 |
|
|
<td align="left" valign="top">
|
761 |
|
|
<p style="margin: 4px; padding: 4px 0 4px 0; width: 94%;">
|
762 |
|
|
<input name="pppoe_pr_type" type="radio" id="pppoe_pr_custom" value="custom" <?php if ($pconfig['pppoe_pr_custom']) echo "checked=\"checked\""; ?> onclick="if (this.checked) { Effect.Appear('pppoecustomwrap', { duration: 1.0 }); Effect.Fade('pppoepresetwrap', { duration: 1.0 }); }" />
|
763 |
|
|
<?= gettext("provide a custom reset time"); ?>
|
764 |
|
|
<br />
|
765 |
|
|
<input name="pppoe_pr_type" type="radio" id="pppoe_pr_preset" value="preset" <?php if ($pconfig['pppoe_pr_preset']) echo "checked=\"checked\""; ?> onclick="if (this.checked) { Effect.Appear('pppoepresetwrap', { duration: 1.0 }); Effect.Fade('pppoecustomwrap', { duration: 1.0 }); }" />
|
766 |
|
|
<?= gettext("select reset time from a preset"); ?>
|
767 |
|
|
</p>
|
768 |
|
|
<?php if ($pconfig['pppoe_pr_custom']): ?>
|
769 |
|
|
<p style="margin: 2px; padding: 4px; width: 94%;" id="pppoecustomwrap">
|
770 |
|
|
<?php else: ?>
|
771 |
|
|
<p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoecustomwrap">
|
772 |
|
|
<?php endif; ?>
|
773 |
|
|
<input type="text" name="pppoe_resethour" class="fd_incremental_inp_range_0_23 fd_increment_1 fd_classname_dec_buttonDec fd_classname_inc_buttonInc" maxlength="2" id="pppoe_resethour" value="<?= $pconfig['pppoe_resethour']; ?>" size="3" />
|
774 |
|
|
<?= gettext("hour (0-23)"); ?><br />
|
775 |
|
|
<input type="text" name="pppoe_resetminute" class="fd_incremental_inp_range_0_59 fd_increment_1 fd_classname_dec_buttonDec fd_classname_inc_buttonInc" maxlength="2" id="pppoe_resetminute" value="<?= $pconfig['pppoe_resetminute']; ?>" size="3" />
|
776 |
|
|
<?= gettext("minute (0-59)"); ?><br />
|
777 |
|
|
<input name="pppoe_resetdate" type="text" class="w8em format-m-d-y highlight-days-67" id="pppoe_resetdate" maxlength="10" size="10" value="<?=htmlspecialchars($pconfig['pppoe_resetdate']);?>" />
|
778 |
|
|
<?= gettext("reset at a specific date (mm/dd/yyyy)"); ?>
|
779 |
|
|
<br /> <br />
|
780 |
|
|
<span class="red"><strong>Note: </strong></span>
|
781 |
|
|
If you leave the date field empty, the reset will be executed each day at the time you did specify using the minutes and hour field.
|
782 |
|
|
</p>
|
783 |
|
|
<?php if ($pconfig['pppoe_pr_preset']): ?>
|
784 |
|
|
<p style="margin: 2px; padding: 4px; width: 94%;" id="pppoepresetwrap">
|
785 |
|
|
<?php else: ?>
|
786 |
|
|
<p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoepresetwrap">
|
787 |
|
|
<?php endif; ?>
|
788 |
|
|
<input name="pppoe_pr_preset_val" type="radio" id="pppoe_monthly" value="monthly" <?php if ($pconfig['pppoe_monthly']) echo "checked=\"checked\""; ?> />
|
789 |
|
|
<?= gettext("reset at each month ('0 0 1 * *')"); ?>
|
790 |
|
|
<br />
|
791 |
|
|
<input name="pppoe_pr_preset_val" type="radio" id="pppoe_weekly" value="weekly" <?php if ($pconfig['pppoe_weekly']) echo "checked=\"checked\""; ?> />
|
792 |
|
|
<?= gettext("reset at each week ('0 0 * * 0')"); ?>
|
793 |
|
|
<br />
|
794 |
|
|
<input name="pppoe_pr_preset_val" type="radio" id="pppoe_daily" value="daily" <?php if ($pconfig['pppoe_daily']) echo "checked=\"checked\""; ?> />
|
795 |
|
|
<?= gettext("reset at each day ('0 0 * * *')"); ?>
|
796 |
|
|
<br />
|
797 |
|
|
<input name="pppoe_pr_preset_val" type="radio" id="pppoe_hourly" value="hourly" <?php if ($pconfig['pppoe_hourly']) echo "checked=\"checked\""; ?> />
|
798 |
|
|
<?= gettext("reset at each hour ('0 * * * *')"); ?>
|
799 |
|
|
</p>
|
800 |
|
|
</td>
|
801 |
|
|
</tr>
|
802 |
|
|
</table>
|
803 |
|
|
</td>
|
804 |
|
|
</tr>
|
805 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
806 |
5b237745
|
Scott Ullrich
|
<td colspan="2" valign="top" height="16"></td>
|
807 |
|
|
</tr>
|
808 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
809 |
a23d7248
|
Scott Ullrich
|
<td colspan="2" valign="top" class="listtopic">PPTP configuration</td>
|
810 |
5b237745
|
Scott Ullrich
|
</tr>
|
811 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
812 |
5b237745
|
Scott Ullrich
|
<td valign="top" class="vncellreq">Username</td>
|
813 |
e2cd32df
|
Scott Ullrich
|
<td class="vtable"><input name="pptp_username" type="text" class="formfld" id="pptp_username" size="20" value="<?=htmlspecialchars($pconfig['pptp_username']);?>">
|
814 |
5b237745
|
Scott Ullrich
|
</td>
|
815 |
|
|
</tr>
|
816 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
817 |
5b237745
|
Scott Ullrich
|
<td valign="top" class="vncellreq">Password</td>
|
818 |
e2cd32df
|
Scott Ullrich
|
<td class="vtable"><input name="pptp_password" type="text" class="formfld" id="pptp_password" size="20" value="<?=htmlspecialchars($pconfig['pptp_password']);?>">
|
819 |
5b237745
|
Scott Ullrich
|
</td>
|
820 |
|
|
</tr>
|
821 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
822 |
5b237745
|
Scott Ullrich
|
<td width="100" valign="top" class="vncellreq">Local IP address</td>
|
823 |
|
|
<td class="vtable"> <input name="pptp_local" type="text" class="formfld" id="pptp_local" size="20" value="<?=htmlspecialchars($pconfig['pptp_local']);?>">
|
824 |
e2cd32df
|
Scott Ullrich
|
/
|
825 |
5b237745
|
Scott Ullrich
|
<select name="pptp_subnet" class="formfld" id="pptp_subnet">
|
826 |
a23d7248
|
Scott Ullrich
|
<?php for ($i = 31; $i > 0; $i--): ?>
|
827 |
e2cd32df
|
Scott Ullrich
|
<option value="<?=$i;?>" <?php if ($i == $pconfig['pptp_subnet']) echo "selected"; ?>>
|
828 |
5b237745
|
Scott Ullrich
|
<?=$i;?>
|
829 |
|
|
</option>
|
830 |
|
|
<?php endfor; ?>
|
831 |
|
|
</select></td>
|
832 |
|
|
</tr>
|
833 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
834 |
5b237745
|
Scott Ullrich
|
<td width="100" valign="top" class="vncellreq">Remote IP address</td>
|
835 |
e2cd32df
|
Scott Ullrich
|
<td class="vtable"> <input name="pptp_remote" type="text" class="formfld" id="pptp_remote" size="20" value="<?=htmlspecialchars($pconfig['pptp_remote']);?>">
|
836 |
5b237745
|
Scott Ullrich
|
</td>
|
837 |
|
|
</tr>
|
838 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
839 |
5b237745
|
Scott Ullrich
|
<td valign="top" class="vncell">Dial on demand</td>
|
840 |
e2cd32df
|
Scott Ullrich
|
<td class="vtable"><input name="pptp_dialondemand" type="checkbox" id="pptp_dialondemand" value="enable" <?php if ($pconfig['pptp_dialondemand']) echo "checked"; ?> onClick="enable_change_pptp(false)" >
|
841 |
5b237745
|
Scott Ullrich
|
<strong>Enable Dial-On-Demand mode</strong><br>
|
842 |
|
|
This option causes the interface to operate in dial-on-demand mode, allowing you to have a <i>virtual full time</i> connection. The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected.</td>
|
843 |
|
|
</tr>
|
844 |
|
|
<tr>
|
845 |
|
|
<td valign="top" class="vncell">Idle timeout</td>
|
846 |
|
|
<td class="vtable">
|
847 |
fa3b333d
|
Scott Ullrich
|
<input name="pptp_idletimeout" type="text" class="formfld" id="pptp_idletimeout" size="8" value="<?=htmlspecialchars($pconfig['pptp_idletimeout']);?>"> seconds<br>If no qualifying outgoing packets are transmitted for the specified number of seconds, the connection is brought down. An idle timeout of zero disables this feature.</td>
|
848 |
5b237745
|
Scott Ullrich
|
</tr>
|
849 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
850 |
5b237745
|
Scott Ullrich
|
<td colspan="2" valign="top" height="16"></td>
|
851 |
|
|
</tr>
|
852 |
da56c4d7
|
Scott Ullrich
|
<tr>
|
853 |
|
|
<td colspan="2" valign="top" class="listtopic">FTP Helper</td>
|
854 |
b1c525ee
|
Scott Ullrich
|
</tr>
|
855 |
9575504e
|
Scott Ullrich
|
<tr>
|
856 |
|
|
<td width="22%" valign="top" class="vncell">FTP Helper</td>
|
857 |
|
|
<td width="78%" class="vtable">
|
858 |
|
|
<input name="disableftpproxy" type="checkbox" id="disableftpproxy" value="yes" <?php if ($pconfig['disableftpproxy']) echo "checked"; ?> onclick="enable_change(false)" />
|
859 |
|
|
<strong>Disable the userland FTP-Proxy application</strong>
|
860 |
|
|
<br />
|
861 |
|
|
</td>
|
862 |
|
|
</tr>
|
863 |
fa3b333d
|
Scott Ullrich
|
<?php
|
864 |
|
|
/* Wireless interface? */
|
865 |
b7f01f59
|
Bill Marquette
|
if (isset($wancfg['wireless']))
|
866 |
5b237745
|
Scott Ullrich
|
wireless_config_print();
|
867 |
fa3b333d
|
Scott Ullrich
|
?>
|
868 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
869 |
5b237745
|
Scott Ullrich
|
<td height="16" colspan="2" valign="top"></td>
|
870 |
|
|
</tr>
|
871 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
872 |
5b237745
|
Scott Ullrich
|
<td valign="middle"> </td>
|
873 |
d9eeccbd
|
Scott Ullrich
|
<td class="vtable"><a name="rfc1918"></a> <input name="blockpriv" type="checkbox" id="blockpriv" value="yes" <?php if ($pconfig['blockpriv']) echo "checked"; ?>>
|
874 |
5b237745
|
Scott Ullrich
|
<strong>Block private networks</strong><br>
|
875 |
e2cd32df
|
Scott Ullrich
|
When set, this option blocks traffic from IP addresses that
|
876 |
5b237745
|
Scott Ullrich
|
are reserved for private<br>
|
877 |
e2cd32df
|
Scott Ullrich
|
networks as per RFC 1918 (10/8, 172.16/12, 192.168/16) as
|
878 |
5b237745
|
Scott Ullrich
|
well as loopback addresses<br>
|
879 |
e2cd32df
|
Scott Ullrich
|
(127/8). You should generally leave this option turned on,
|
880 |
5b237745
|
Scott Ullrich
|
unless your WAN network<br>
|
881 |
|
|
lies in such a private address space, too.</td>
|
882 |
|
|
</tr>
|
883 |
ff1955ee
|
Bill Marquette
|
<tr>
|
884 |
|
|
<td valign="middle"> </td>
|
885 |
|
|
<td class="vtable"> <input name="blockbogons" type="checkbox" id="blockbogons" value="yes" <?php if ($pconfig['blockbogons']) echo "checked"; ?>>
|
886 |
|
|
<strong>Block bogon networks</strong><br>
|
887 |
|
|
When set, this option blocks traffic from IP addresses that
|
888 |
|
|
are reserved (but not RFC 1918) or not yet assigned by IANA.<br>
|
889 |
|
|
Bogons are prefixes that should never appear in the Internet routing table, and obviously should not appear as the source address in any packets you receive.</td>
|
890 |
9575504e
|
Scott Ullrich
|
</tr>
|
891 |
e2cd32df
|
Scott Ullrich
|
<tr>
|
892 |
5b237745
|
Scott Ullrich
|
<td width="100" valign="top"> </td>
|
893 |
e2cd32df
|
Scott Ullrich
|
<td> <br> <input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change_pptp(true)&&enable_change(true)">
|
894 |
5b237745
|
Scott Ullrich
|
</td>
|
895 |
|
|
</tr>
|
896 |
|
|
</table>
|
897 |
|
|
</form>
|
898 |
|
|
<script language="JavaScript">
|
899 |
|
|
<!--
|
900 |
|
|
type_change();
|
901 |
|
|
//-->
|
902 |
|
|
</script>
|
903 |
|
|
<?php include("fend.inc"); ?>
|
904 |
|
|
</body>
|
905 |
|
|
</html>
|
906 |
e4e8c30f
|
Scott Ullrich
|
|
907 |
|
|
|
908 |
|
|
<?php
|
909 |
|
|
|
910 |
|
|
if ($_POST) {
|
911 |
|
|
|
912 |
|
|
if (!$input_errors) {
|
913 |
b1c525ee
|
Scott Ullrich
|
|
914 |
|
|
unlink_if_exists("{$g['tmp_path']}/config.cache");
|
915 |
|
|
|
916 |
2e70a096
|
Scott Ullrich
|
ob_flush();
|
917 |
|
|
flush();
|
918 |
b1c525ee
|
Scott Ullrich
|
sleep(1);
|
919 |
|
|
|
920 |
e4e8c30f
|
Scott Ullrich
|
interfaces_wan_configure();
|
921 |
b1c525ee
|
Scott Ullrich
|
|
922 |
610b1136
|
Scott Ullrich
|
reset_carp();
|
923 |
b1c525ee
|
Scott Ullrich
|
|
924 |
e4e8c30f
|
Scott Ullrich
|
/* sync filter configuration */
|
925 |
|
|
filter_configure();
|
926 |
276a350f
|
Scott Ullrich
|
|
927 |
|
|
/* set up static routes */
|
928 |
|
|
system_routing_configure();
|
929 |
|
|
|
930 |
e4e8c30f
|
Scott Ullrich
|
}
|
931 |
|
|
}
|
932 |
|
|
|
933 |
276a350f
|
Scott Ullrich
|
?>
|