1 |
|
<?php
|
2 |
|
/* $Id$ */
|
3 |
|
/*
|
4 |
|
interfaces_mlppp_edit.php
|
5 |
|
part of m0n0wall (http://m0n0.ch/wall)
|
6 |
|
|
7 |
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
8 |
|
All rights reserved.
|
9 |
|
Copyright (C) 2010 Gabriel B. <gnoahb@gmail.com>.
|
10 |
|
All rights reserved.
|
11 |
|
|
12 |
|
Redistribution and use in source and binary forms, with or without
|
13 |
|
modification, are permitted provided that the following conditions are met:
|
14 |
|
|
15 |
|
1. Redistributions of source code must retain the above copyright notice,
|
16 |
|
this list of conditions and the following disclaimer.
|
17 |
|
|
18 |
|
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 |
|
|
22 |
|
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 |
|
pfSense_MODULE: interfaces
|
35 |
|
*/
|
36 |
|
|
37 |
|
##|+PRIV
|
38 |
|
##|*IDENT=page-interfaces-mlppp-edit
|
39 |
|
##|*NAME=Interfaces: MLPPP: Edit page
|
40 |
|
##|*DESCR=Allow access to the 'Interfaces: MLPPP: Edit' page.
|
41 |
|
##|*MATCH=interfaces_mlppp_edit.php*
|
42 |
|
##|-PRIV
|
43 |
|
|
44 |
|
require("guiconfig.inc");
|
45 |
|
|
46 |
|
define("CRON_PPPOE_CMD_FILE", "/conf/pppoe{$if}restart");
|
47 |
|
define("CRON_MONTHLY_PATTERN", "0 0 1 * *");
|
48 |
|
define("CRON_WEEKLY_PATTERN", "0 0 * * 0");
|
49 |
|
define("CRON_DAILY_PATTERN", "0 0 * * *");
|
50 |
|
define("CRON_HOURLY_PATTERN", "0 * * * *");
|
51 |
|
|
52 |
|
if (!is_array($config['ppps']['ppp']))
|
53 |
|
$config['ppps']['ppp'] = array();
|
54 |
|
|
55 |
|
$a_ppps = &$config['ppps']['ppp'];
|
56 |
|
|
57 |
|
$portlist = get_interface_list();
|
58 |
|
|
59 |
|
function getMPDCRONSettings() {
|
60 |
|
global $config;
|
61 |
|
if (is_array($config['cron']['item'])) {
|
62 |
|
for ($i = 0; $i < count($config['cron']['item']); $i++) {
|
63 |
|
$item = $config['cron']['item'][$i];
|
64 |
|
if (strpos($item['command'], CRON_PPPOE_CMD_FILE) !== false) {
|
65 |
|
return array("ID" => $i, "ITEM" => $item);
|
66 |
|
}
|
67 |
|
}
|
68 |
|
}
|
69 |
|
return NULL;
|
70 |
|
}
|
71 |
|
|
72 |
|
function getMPDResetTimeFromConfig() {
|
73 |
|
$itemhash = getMPDCRONSettings();
|
74 |
|
$cronitem = $itemhash['ITEM'];
|
75 |
|
if (isset($cronitem)) {
|
76 |
|
return "{$cronitem['minute']} {$cronitem['hour']} {$cronitem['mday']} {$cronitem['month']} {$cronitem['wday']}";
|
77 |
|
} else {
|
78 |
|
return NULL;
|
79 |
|
}
|
80 |
|
}
|
81 |
|
|
82 |
|
function remove_bad_chars($string) {
|
83 |
|
return preg_replace('/[^a-z|_|0-9]/i','',$string);
|
84 |
|
}
|
85 |
|
|
86 |
|
$id = $_GET['id'];
|
87 |
|
if (isset($_POST['id']))
|
88 |
|
$id = $_POST['id'];
|
89 |
|
|
90 |
|
|
91 |
|
if (isset($id) && $a_ppps[$id]) {
|
92 |
|
$pconfig['type'] = $a_ppps[$id]['type'];
|
93 |
|
$pconfig['interfaces'] = $a_ppps[$id]['ports'];
|
94 |
|
$pconfig['username'] = $a_ppps[$id]['username'];
|
95 |
|
$pconfig['password'] = base64_decode($a_ppps[$id]['password']);
|
96 |
|
if (isset($a_ppps[$id]['defaultgw']))
|
97 |
|
$pconfig['defaultgw'] = true;
|
98 |
|
if (isset($a_ppps[$id]['ondemand']))
|
99 |
|
$pconfig['ondemand'] = true;
|
100 |
|
$pconfig['idletimeout'] = $a_ppps[$id]['idletimeout'];
|
101 |
|
$pconfig['uptime'] = $a_ppps[$id]['uptime'];
|
102 |
|
$pconfig['descr'] = $a_ppps[$id]['descr'];
|
103 |
|
$pconfig['bandwidth'] = explode(",",$a_ppps[$id]['bandwidth']);
|
104 |
|
$pconfig['mtu'] = explode(",",$a_ppps[$id]['mtu']);
|
105 |
|
$pconfig['mru'] = explode(",",$a_ppps[$id]['mru']);
|
106 |
|
$pconfig['mrru'] = $a_ppps[$id]['mrru'];
|
107 |
|
if (isset($a_ppps[$id]['shortseq']))
|
108 |
|
$pconfig['shortseq'] = true;
|
109 |
|
if (isset($a_ppps[$id]['acfcomp']))
|
110 |
|
$pconfig['acfcomp'] = true;
|
111 |
|
if (isset($a_ppps[$id]['protocomp']))
|
112 |
|
$pconfig['protocomp'] = true;
|
113 |
|
if (isset($a_ppps[$id]['vjcomp']))
|
114 |
|
$pconfig['vjcomp'] = true;
|
115 |
|
if (isset($a_ppps[$id]['tcpmssfix']))
|
116 |
|
$pconfig['tcpmssfix'] = true;
|
117 |
|
if ($a_ppps[$id]['type'] == "ppp") {
|
118 |
|
$pconfig['initstr'] = base64_decode($a_ppps[$id]['initstr']);
|
119 |
|
$pconfig['simpin'] = $a_ppps[$id]['simpin'];
|
120 |
|
$pconfig['pin-wait'] = $a_ppps[$id]['pin-wait'];
|
121 |
|
$pconfig['apn'] = $a_ppps[$id]['apn'];
|
122 |
|
$pconfig['apnum'] = $a_ppps[$id]['apnum'];
|
123 |
|
$pconfig['phone'] = $a_ppps[$id]['phone'];
|
124 |
|
$pconfig['connect-timeout'] = $a_ppps[$id]['connect-timeout'];
|
125 |
|
$pconfig['localip'] = $a_ppps[$id]['localip'];
|
126 |
|
$pconfig['gateway'] = $a_ppps[$id]['gateway'];
|
127 |
|
}
|
128 |
|
if ($a_ppps[$id]['type'] == "pptp") {
|
129 |
|
$pconfig['localip'] = $a_ppps[$id]['localip'];
|
130 |
|
$pconfig['subnet'] = $a_ppps[$id]['subnet'];
|
131 |
|
$pconfig['gateway'] = $a_ppps[$id]['gateway'];
|
132 |
|
}
|
133 |
|
if ($a_ppps[$id]['type'] == "pppoe") {
|
134 |
|
$pconfig['provider'] = $a_ppps[$id]['provider'];
|
135 |
|
/* ================================================ */
|
136 |
|
/* = force a connection reset at a specific time? = */
|
137 |
|
/* ================================================ */
|
138 |
|
|
139 |
|
if (isset($a_ppps[$id]['pppoe-reset-type'])) {
|
140 |
|
$resetTime = getMPDResetTimeFromConfig();
|
141 |
|
$pconfig['pppoe_preset'] = true;
|
142 |
|
if ($a_ppps[$id]['pppoe-reset-type'] == "custom") {
|
143 |
|
$resetTime_a = split(" ", $resetTime);
|
144 |
|
$pconfig['pppoe_pr_custom'] = true;
|
145 |
|
$pconfig['pppoe_resetminute'] = $resetTime_a[0];
|
146 |
|
$pconfig['pppoe_resethour'] = $resetTime_a[1];
|
147 |
|
/* just initialize $pconfig['pppoe_resetdate'] if the
|
148 |
|
* coresponding item contains appropriate numeric values.
|
149 |
|
*/
|
150 |
|
if ($resetTime_a[2] <> "*" && $resetTime_a[3] <> "*")
|
151 |
|
$pconfig['pppoe_resetdate'] = "{$resetTime_a[3]}/{$resetTime_a[2]}/" . date("Y");
|
152 |
|
} else if ($a_ppps[$id]['pppoe-reset-type'] == "preset") {
|
153 |
|
$pconfig['pppoe_pr_preset'] = true;
|
154 |
|
switch ($resetTime) {
|
155 |
|
case CRON_MONTHLY_PATTERN:
|
156 |
|
$pconfig['pppoe_monthly'] = true;
|
157 |
|
break;
|
158 |
|
case CRON_WEEKLY_PATTERN:
|
159 |
|
$pconfig['pppoe_weekly'] = true;
|
160 |
|
break;
|
161 |
|
case CRON_DAILY_PATTERN:
|
162 |
|
$pconfig['pppoe_daily'] = true;
|
163 |
|
break;
|
164 |
|
case CRON_HOURLY_PATTERN:
|
165 |
|
$pconfig['pppoe_hourly'] = true;
|
166 |
|
break;
|
167 |
|
}
|
168 |
|
}
|
169 |
|
}
|
170 |
|
}
|
171 |
|
|
172 |
|
}
|
173 |
|
|
174 |
|
if ($_POST) {
|
175 |
|
|
176 |
|
unset($input_errors);
|
177 |
|
$pconfig = $_POST;
|
178 |
|
|
179 |
|
/* filter out spaces from descriptions */
|
180 |
|
$_POST['descr'] = remove_bad_chars($_POST['descr']);
|
181 |
|
|
182 |
|
/* okay first of all, cause we are just hiding the PPPoE HTML
|
183 |
|
* fields releated to PPPoE resets, we are going to unset $_POST
|
184 |
|
* vars, if the reset feature should not be used. Otherwise the
|
185 |
|
* data validation procedure below, may trigger a false error
|
186 |
|
* message.
|
187 |
|
*/
|
188 |
|
if (empty($_POST['pppoe_preset'])) {
|
189 |
|
unset($_POST['pppoe_pr_type']);
|
190 |
|
unset($_POST['pppoe_resethour']);
|
191 |
|
unset($_POST['pppoe_resetminute']);
|
192 |
|
unset($_POST['pppoe_resetdate']);
|
193 |
|
unset($_POST['pppoe_pr_preset_val']);
|
194 |
|
}
|
195 |
|
|
196 |
|
/* input validation */
|
197 |
|
switch($_POST['type']) {
|
198 |
|
case "ppp":
|
199 |
|
$reqdfields = explode(" ", "interfaces phone");
|
200 |
|
$reqdfieldsn = explode(",", "Link Interface(s),Phone Number");
|
201 |
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
202 |
|
break;
|
203 |
|
case "pppoe":
|
204 |
|
if ($_POST['ondemand']) {
|
205 |
|
$reqdfields = explode(" ", "interfaces username password ondemand idletimeout");
|
206 |
|
$reqdfieldsn = explode(",", "Link Interface(s),Username,Password,Dial on demand,Idle timeout value");
|
207 |
|
} else {
|
208 |
|
$reqdfields = explode(" ", "interfaces username password");
|
209 |
|
$reqdfieldsn = explode(",", "Link Interface(s),Username,Password");
|
210 |
|
}
|
211 |
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
212 |
|
break;
|
213 |
|
case "pptp":
|
214 |
|
if ($_POST['ondemand']) {
|
215 |
|
$reqdfields = explode(" ", "interfaces username password localip subnet gateway ondemand idletimeout");
|
216 |
|
$reqdfieldsn = explode(",", "Link Interface(s),Username,Password,Local IP address,Subnet,Remote IP address,Dial on demand,Idle timeout value");
|
217 |
|
} else {
|
218 |
|
$reqdfields = explode(" ", "interfaces username password localip subnet gateway");
|
219 |
|
$reqdfieldsn = explode(",", "Link Interface(s),Username,Password,Local IP address,Subnet,Remote IP address");
|
220 |
|
}
|
221 |
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
222 |
|
break;
|
223 |
|
default:
|
224 |
|
$input_errors[] = "Please choose a Link Type.";
|
225 |
|
break;
|
226 |
|
}
|
227 |
|
if (($_POST['provider'] && !is_domain($_POST['provider'])))
|
228 |
|
$input_errors[] = "The service name contains invalid characters.";
|
229 |
|
if (($_POST['idletimeout'] != "") && !is_numericint($_POST['idletimeout']))
|
230 |
|
$input_errors[] = "The idle timeout value must be an integer.";
|
231 |
|
if ($_POST['pppoe_resethour'] <> "" && !is_numericint($_POST['pppoe_resethour']) &&
|
232 |
|
$_POST['pppoe_resethour'] >= 0 && $_POST['pppoe_resethour'] <=23)
|
233 |
|
$input_errors[] = gettext("A valid PPPoE reset hour must be specified (0-23).");
|
234 |
|
if ($_POST['pppoe_resetminute'] <> "" && !is_numericint($_POST['pppoe_resetminute']) &&
|
235 |
|
$_POST['pppoe_resetminute'] >= 0 && $_POST['pppoe_resetminute'] <=59)
|
236 |
|
$input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59).");
|
237 |
|
if ($_POST['pppoe_resetdate'] <> "" && !is_numeric(str_replace("/", "", $_POST['pppoe_resetdate'])))
|
238 |
|
$input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy).");
|
239 |
|
if (($_POST['localip'] && !is_ipaddr($_POST['localip'])))
|
240 |
|
$input_errors[] = "A valid PPTP local IP address must be specified.";
|
241 |
|
if (($_POST['subnet'] && !is_numeric($_POST['subnet'])))
|
242 |
|
$input_errors[] = "A valid PPTP subnet bit count must be specified.";
|
243 |
|
if (($_POST['gateway'] && !is_ipaddr($_POST['gateway'])))
|
244 |
|
$input_errors[] = "A valid PPTP remote IP address must be specified.";
|
245 |
|
/*
|
246 |
|
if (($_POST['bandwidth'] != "") && !is_numericint($_POST['bandwidth']))
|
247 |
|
$input_errors[] = "The bandwidth value must be an integer.";
|
248 |
|
if ($_POST['mtu'] && ($_POST['mtu'] < 576))
|
249 |
|
$input_errors[] = "The MTU must be greater than 576 bytes.";
|
250 |
|
if ($_POST['mru'] && ($_POST['mru'] < 576))
|
251 |
|
$input_errors[] = "The MRU must be greater than 576 bytes.";
|
252 |
|
*/
|
253 |
|
|
254 |
|
/*
|
255 |
|
foreach ($a_ppps as $ppp) {
|
256 |
|
if (isset($id) && ($a_ppps[$id]) && ($a_ppps[$id] === $ppp))
|
257 |
|
continue;
|
258 |
|
|
259 |
|
if ($ppp['serialport'] == $_POST['serialport']) {
|
260 |
|
$input_errors[] = "Serial port is in use";
|
261 |
|
break;
|
262 |
|
}
|
263 |
|
}
|
264 |
|
*/
|
265 |
|
|
266 |
|
if (!$input_errors) {
|
267 |
|
$ppp = array();
|
268 |
|
$ppp['type'] = $_POST['type'];
|
269 |
|
$ppp['ports'] = implode(',', $_POST['interfaces']);
|
270 |
|
$ppp['username'] = $_POST['username'];
|
271 |
|
$ppp['password'] = base64_encode($_POST['password']);
|
272 |
|
$ppp['defaultgw'] = $_POST['defaultgw'] ? true : false;
|
273 |
|
$ppp['ondemand'] = $_POST['ondemand'] ? true : false;
|
274 |
|
if (!empty($_POST['idletimeout']))
|
275 |
|
$ppp['idletimeout'] = $_POST['idletimeout'];
|
276 |
|
else
|
277 |
|
unset($ppp['idletimeout']);
|
278 |
|
$ppp['uptime'] = $_POST['uptime'] ? true : false;
|
279 |
|
if (!empty($_POST['descr']))
|
280 |
|
$ppp['descr'] = $_POST['descr'];
|
281 |
|
else
|
282 |
|
unset($ppp['descr']);
|
283 |
|
switch($_POST['type']) {
|
284 |
|
case "ppp":
|
285 |
|
if (!empty($_POST['initstr']))
|
286 |
|
$ppp['initstr'] = base64_encode($_POST['initstr']);
|
287 |
|
else
|
288 |
|
unset($ppp['initstr']);
|
289 |
|
if (!empty($_POST['simpin'])) {
|
290 |
|
$ppp['simpin'] = $_POST['simpin'];
|
291 |
|
$ppp['pin-wait'] = $_POST['pin-wait'];
|
292 |
|
} else {
|
293 |
|
unset($ppp['simpin']);
|
294 |
|
unset($ppp['pin-wait']);
|
295 |
|
}
|
296 |
|
|
297 |
|
if (!empty($_POST['apn'])){
|
298 |
|
$ppp['apn'] = $_POST['apn'];
|
299 |
|
if (!empty($_POST['apnum']))
|
300 |
|
$ppp['apnum'] = $_POST['apnum'];
|
301 |
|
else
|
302 |
|
$ppp['apnum'] = "1";
|
303 |
|
} else {
|
304 |
|
unset($ppp['apn']);
|
305 |
|
unset($ppp['apnum']);
|
306 |
|
}
|
307 |
|
$ppp['phone'] = $_POST['phone'];
|
308 |
|
if (!empty($_POST['localip']))
|
309 |
|
$ppp['localip'] = $_POST['localip'];
|
310 |
|
else
|
311 |
|
unset($ppp['localip']);
|
312 |
|
if (!empty($_POST['gateway']))
|
313 |
|
$ppp['gateway'] = $_POST['gateway'];
|
314 |
|
else
|
315 |
|
unset($ppp['gateway']);
|
316 |
|
if (!empty($_POST['connect-timeout']))
|
317 |
|
$ppp['connect-timeout'] = $_POST['connect-timeout'];
|
318 |
|
else
|
319 |
|
unset($ppp['connect-timeout']);
|
320 |
|
break;
|
321 |
|
case "pppoe":
|
322 |
|
if (!empty($_POST['provider']))
|
323 |
|
$ppp['provider'] = $_POST['provider'];
|
324 |
|
else
|
325 |
|
unset($ppp['provider']);
|
326 |
|
handle_pppoe_reset();
|
327 |
|
break;
|
328 |
|
case "pptp":
|
329 |
|
$ppp['localip'] = $_POST['localip'];
|
330 |
|
$ppp['subnet'] = $_POST['subnet'];
|
331 |
|
$ppp['gateway'] = $_POST['gateway'];
|
332 |
|
break;
|
333 |
|
default:
|
334 |
|
break;
|
335 |
|
|
336 |
|
}
|
337 |
|
/* reset cron items if necessary */
|
338 |
|
if (empty($_POST['pppoe_preset'])) {
|
339 |
|
/* test whether a cron item exists and unset() it if necessary */
|
340 |
|
$itemhash = getMPDCRONSettings();
|
341 |
|
$item = $itemhash['ITEM'];
|
342 |
|
if (isset($item))
|
343 |
|
unset($config['cron']['item'][$itemhash['ID']]);
|
344 |
|
}
|
345 |
|
$ppp['shortseq'] = $_POST['shortseq'] ? true : false;
|
346 |
|
$ppp['acfcomp'] = $_POST['acfcomp'] ? true : false;
|
347 |
|
$ppp['protocomp'] = $_POST['protocomp'] ? true : false;
|
348 |
|
$ppp['vjcomp'] = $_POST['vjcomp'] ? true : false;
|
349 |
|
$ppp['tcpmssfix'] = $_POST['tcpmssfix'] ? true : false;
|
350 |
|
if (isset($_POST['bandwidth']))
|
351 |
|
$ppp['bandwidth'] = implode(',', $_POST['bandwidth']);
|
352 |
|
else
|
353 |
|
unset($ppp['bandwidth']);
|
354 |
|
if (isset($_POST['mtu']))
|
355 |
|
$ppp['mtu'] = implode(',', $_POST['mtu']);
|
356 |
|
else
|
357 |
|
unset($ppp['mtu']);
|
358 |
|
if (isset($_POST['mru']))
|
359 |
|
$ppp['mru'] = implode(',', $_POST['mru']);
|
360 |
|
else
|
361 |
|
unset($ppp['mru']);
|
362 |
|
|
363 |
|
|
364 |
|
$iflist = get_configured_interface_list();
|
365 |
|
/*
|
366 |
|
foreach ($iflist as $if) {
|
367 |
|
if ($config['interfaces'][$if]['if'] == basename($a_ppps[$id]['port']))
|
368 |
|
$config['interfaces'][$if]['if'] = basename($ppp['port']);
|
369 |
|
}
|
370 |
|
*/
|
371 |
|
if (isset($id) && $a_ppps[$id])
|
372 |
|
$a_ppps[$id] = $ppp;
|
373 |
|
else
|
374 |
|
$a_ppps[] = $ppp;
|
375 |
|
|
376 |
|
write_config();
|
377 |
|
|
378 |
|
header("Location: interfaces_mlppp.php");
|
379 |
|
exit;
|
380 |
|
}
|
381 |
|
} // end if($_POST)
|
382 |
|
|
383 |
|
function handle_pppoe_reset() {
|
384 |
|
global $_POST, $config, $g, $ppp, $if;
|
385 |
|
/* perform a periodic reset? */
|
386 |
|
if(!isset($_POST['pppoe_preset'])) {
|
387 |
|
setup_pppoe_reset_file($if, false);
|
388 |
|
return;
|
389 |
|
}
|
390 |
|
if (!is_array($config['cron']['item']))
|
391 |
|
$config['cron']['item'] = array();
|
392 |
|
$itemhash = getMPDCRONSettings();
|
393 |
|
$item = $itemhash['ITEM'];
|
394 |
|
if (empty($item))
|
395 |
|
$item = array();
|
396 |
|
if (isset($_POST['pppoe_pr_type']) && $_POST['pppoe_pr_type'] == "custom") {
|
397 |
|
$ppp['pppoe-reset-type'] = "custom";
|
398 |
|
$pconfig['pppoe_pr_custom'] = true;
|
399 |
|
$item['minute'] = $_POST['pppoe_resetminute'];
|
400 |
|
$item['hour'] = $_POST['pppoe_resethour'];
|
401 |
|
if (isset($_POST['pppoe_resetdate']) && $_POST['pppoe_resetdate'] <> "" && strlen($_POST['pppoe_resetdate']) == 10) {
|
402 |
|
$date = explode("/", $_POST['pppoe_resetdate']);
|
403 |
|
$item['mday'] = $date[1];
|
404 |
|
$item['month'] = $date[0];
|
405 |
|
} else {
|
406 |
|
$item['mday'] = "*";
|
407 |
|
$item['month'] = "*";
|
408 |
|
}
|
409 |
|
$item['wday'] = "*";
|
410 |
|
$item['who'] = "root";
|
411 |
|
$item['command'] = CRON_PPPOE_CMD_FILE;
|
412 |
|
} else if (isset($_POST['pppoe_pr_type']) && $_POST['pppoe_pr_type'] = "preset") {
|
413 |
|
$ppp['pppoe-reset-type'] = "preset";
|
414 |
|
$pconfig['pppoe_pr_preset'] = true;
|
415 |
|
switch ($_POST['pppoe_pr_preset_val']) {
|
416 |
|
case "monthly":
|
417 |
|
$item['minute'] = "0";
|
418 |
|
$item['hour'] = "0";
|
419 |
|
$item['mday'] = "1";
|
420 |
|
$item['month'] = "*";
|
421 |
|
$item['wday'] = "*";
|
422 |
|
$item['who'] = "root";
|
423 |
|
$item['command'] = CRON_PPPOE_CMD_FILE;
|
424 |
|
break;
|
425 |
|
case "weekly":
|
426 |
|
$item['minute'] = "0";
|
427 |
|
$item['hour'] = "0";
|
428 |
|
$item['mday'] = "*";
|
429 |
|
$item['month'] = "*";
|
430 |
|
$item['wday'] = "0";
|
431 |
|
$item['who'] = "root";
|
432 |
|
$item['command'] = CRON_PPPOE_CMD_FILE;
|
433 |
|
break;
|
434 |
|
case "daily":
|
435 |
|
$item['minute'] = "0";
|
436 |
|
$item['hour'] = "0";
|
437 |
|
$item['mday'] = "*";
|
438 |
|
$item['month'] = "*";
|
439 |
|
$item['wday'] = "*";
|
440 |
|
$item['who'] = "root";
|
441 |
|
$item['command'] = CRON_PPPOE_CMD_FILE;
|
442 |
|
break;
|
443 |
|
case "hourly":
|
444 |
|
$item['minute'] = "0";
|
445 |
|
$item['hour'] = "*";
|
446 |
|
$item['mday'] = "*";
|
447 |
|
$item['month'] = "*";
|
448 |
|
$item['wday'] = "*";
|
449 |
|
$item['who'] = "root";
|
450 |
|
$item['command'] = CRON_PPPOE_CMD_FILE;
|
451 |
|
break;
|
452 |
|
} // end switch
|
453 |
|
} // end if
|
454 |
|
if (isset($itemhash['ID']))
|
455 |
|
$config['cron']['item'][$itemhash['ID']] = $item;
|
456 |
|
else
|
457 |
|
$config['cron']['item'][] = $item;
|
458 |
|
/* finally install the pppoerestart file */
|
459 |
|
if (isset($_POST['pppoe_preset'])) {
|
460 |
|
setup_pppoe_reset_file($if, true);
|
461 |
|
//$ppp['pppoe_reset'] = true;
|
462 |
|
$ppp['pppoe_preset'] = true;
|
463 |
|
sigkillbypid("{$g['varrun_path']}/cron.pid", "HUP");
|
464 |
|
} else {
|
465 |
|
//unset($ppp['pppoe_reset']);
|
466 |
|
unset($ppp['pppoe_preset']);
|
467 |
|
setup_pppoe_reset_file($if, false);
|
468 |
|
}
|
469 |
|
}
|
470 |
|
|
471 |
|
$closehead = false;
|
472 |
|
$pgtitle = array("Interfaces","MLPPP","Edit");
|
473 |
|
include("head.inc");
|
474 |
|
|
475 |
|
$types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" => "PPTP"/*, "l2tp" => "L2TP", "tcp" => "TCP", "udp" => "UDP", "ng" => "Netgraph" */ );
|
476 |
|
|
477 |
|
?>
|
478 |
|
<script type="text/javascript" >
|
479 |
|
document.observe("dom:loaded", function() { updateType(<?php echo "'{$pconfig['type']}'";?>); });
|
480 |
|
</script>
|
481 |
|
</head>
|
482 |
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" >
|
483 |
|
<?php include("fbegin.inc"); ?>
|
484 |
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
485 |
|
<form action="interfaces_mlppp_edit.php" method="post" name="iform" id="iform">
|
486 |
|
<table id="interfacetable" width="100%" border="0" cellpadding="6" cellspacing="0">
|
487 |
|
<tr>
|
488 |
|
<td colspan="2" valign="top" class="listtopic">MLPPP configuration</td>
|
489 |
|
</tr>
|
490 |
|
<tr>
|
491 |
|
<td valign="middle" class="vncell"><strong>Link Type</strong></td>
|
492 |
|
<td class="vtable">
|
493 |
|
<select name="type" onChange="updateType(this.value);" class="formselect" id="type">
|
494 |
|
<?php
|
495 |
|
foreach ($types as $key => $opt) {
|
496 |
|
echo "<option onClick=\"updateType('{$key}');\"";
|
497 |
|
if ($key == $pconfig['type'])
|
498 |
|
echo " selected";
|
499 |
|
echo " value=\"{$key}\" >" . htmlspecialchars($opt) . "</option>";
|
500 |
|
}
|
501 |
|
?>
|
502 |
|
</select>
|
503 |
|
</td>
|
504 |
|
</tr>
|
505 |
|
<tr name="interface" id="interface" >
|
506 |
|
<td width="22%" valign="top" class="vncellreq">Link interface(s)</td>
|
507 |
|
<td width="78%" class="vtable">
|
508 |
|
<select valign="top" name="interfaces[]" multiple="true" class="formselect" size="4" onChange="show_hide_linkfields();">
|
509 |
|
<option></option>
|
510 |
|
</select>
|
511 |
|
<a href='#' onClick='javascript:clear_selected("interfaces[]");'>Click here</a> to clear selection(s).
|
512 |
|
<br/><span class="vexpl">Interfaces or ports participating in the multilink connection.</span>
|
513 |
|
<span style="display:none" id="prefil_ppp">
|
514 |
|
<p/>Click a link to fill in defaults for these carriers:
|
515 |
|
<a href='#' onClick='javascript:prefill_att();'>ATT</A>
|
516 |
|
<a href='#' onClick='javascript:prefill_sprint();'>Sprint</A>
|
517 |
|
<a href='#' onClick='javascript:prefill_vzw();'>Verizon</A>
|
518 |
|
</span>
|
519 |
|
</td>
|
520 |
|
</tr>
|
521 |
|
<tr style="display:none" name="portlists" id="portlists">
|
522 |
|
<td id="serialports"><?php
|
523 |
|
$selected_ports = explode(",",$pconfig['interfaces']);
|
524 |
|
$serial = glob("/dev/cua*");
|
525 |
|
$modems = glob("/dev/modem*");
|
526 |
|
$serialports = array_merge($serial, $modems);
|
527 |
|
$serport_count = 0;
|
528 |
|
foreach ($serialports as $port) {
|
529 |
|
if(preg_match("/\.(lock|init)$/", $port))
|
530 |
|
continue;
|
531 |
|
$serport_count++;
|
532 |
|
echo $port.",".trim($port);
|
533 |
|
if (in_array($port,$selected_ports))
|
534 |
|
echo ",1|";
|
535 |
|
else
|
536 |
|
echo ",|";
|
537 |
|
}
|
538 |
|
echo $serport_count;
|
539 |
|
?></td>
|
540 |
|
<td id="ports"><?php
|
541 |
|
$port_count = 0;
|
542 |
|
foreach ($portlist as $ifn => $ifinfo){
|
543 |
|
$port_count++;
|
544 |
|
//if (is_jumbo_capable($ifn)) {
|
545 |
|
echo htmlspecialchars($ifn . " (" . $ifinfo['mac'] . ")") . ",{$ifn}";
|
546 |
|
//echo "\"{$ifn}\"";
|
547 |
|
if (stristr($pconfig['interfaces'], $ifn))
|
548 |
|
echo ",1|";
|
549 |
|
else
|
550 |
|
echo ",|";
|
551 |
|
}
|
552 |
|
echo $port_count;
|
553 |
|
if ($serport_count > $port_count)
|
554 |
|
$port_count=$serport_count;
|
555 |
|
?></td>
|
556 |
|
</tr>
|
557 |
|
<tr>
|
558 |
|
<td width="22%" valign="top" class="vncell">Username</td>
|
559 |
|
<td width="78%" class="vtable">
|
560 |
|
<input name="username" type="text" class="formfld usr" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>">
|
561 |
|
</td>
|
562 |
|
</tr>
|
563 |
|
<tr>
|
564 |
|
<td width="22%" valign="top" class="vncell">Password</td>
|
565 |
|
<td width="78%" class="vtable">
|
566 |
|
<input name="password" type="password" class="formfld pwd" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>">
|
567 |
|
</td>
|
568 |
|
</tr>
|
569 |
|
<tr>
|
570 |
|
<td width="22%" valign="top" class="vncell">Gateway</td>
|
571 |
|
<td width="78%" class="vtable">
|
572 |
|
<input type="checkbox" value="on" id="defaultgw" name="defaultgw" <?php if (isset($pconfig['defaultgw'])) echo "checked"; ?>>This link will be used as the default gateway.
|
573 |
|
</td>
|
574 |
|
</tr>
|
575 |
|
<tr>
|
576 |
|
<td valign="top" class="vncell">Dial On Demand</td>
|
577 |
|
<td class="vtable">
|
578 |
|
<input type="checkbox" value="on" id="ondemand" name="ondemand" <?php if (isset($pconfig['ondemand'])) echo "checked"; ?>> Enable Dial-on-Demand mode
|
579 |
|
<br/> <span class="vexpl">This option causes the interface to operate in dial-on-demand mode, allowing you to have a virtual full time connection.
|
580 |
|
The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected. </span>
|
581 |
|
</td>
|
582 |
|
</tr>
|
583 |
|
<tr>
|
584 |
|
<td valign="top" class="vncell">Idle Timeout</td>
|
585 |
|
<td class="vtable">
|
586 |
|
<input name="idletimeout" type="text" class="formfld unknown" id="idletimeout" size="6" value="<?=htmlspecialchars($pconfig['idletimeout']);?>"> seconds
|
587 |
|
<br/> <span class="vexpl">Sets the idle timeout value for the bundle. If no incoming or outgoing packets are transmitted for the set number of seconds
|
588 |
|
the connection is brought down. An idle timeout of zero disables this feature. <bold>Default is 0.</bold>
|
589 |
|
<br/>When the idle timeout occurs, if the dial-on-demand option is enabled, mpd goes back into dial-on-demand mode. Otherwise, the interface is brought down and all associated routes removed.</span>
|
590 |
|
</td>
|
591 |
|
</tr>
|
592 |
|
<tr>
|
593 |
|
<td valign="top" class="vncell">Uptime Logging</td>
|
594 |
|
<td class="vtable">
|
595 |
|
<input type="checkbox" value="on" id="uptime" name="uptime" <?php if (isset($pconfig['uptime'])) echo "checked"; ?>> Enable persistent logging of connection uptime.
|
596 |
|
<br/> <span class="vexpl">This option causes cumulative uptime to be recorded and displayed on the Status Interfaces page.</span>
|
597 |
|
</td>
|
598 |
|
</tr>
|
599 |
|
<tr>
|
600 |
|
<td width="22%" valign="top" class="vncell">Description</td>
|
601 |
|
<td width="78%" class="vtable">
|
602 |
|
<input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>">
|
603 |
|
<br/> <span class="vexpl">You may enter a description here for your reference (not parsed).</span>
|
604 |
|
</td>
|
605 |
|
</tr>
|
606 |
|
<tr>
|
607 |
|
<td colspan="2" valign="top" height="16"></td>
|
608 |
|
</tr>
|
609 |
|
<tr style="display:none" name="select" id="select">
|
610 |
|
</tr>
|
611 |
|
<tr style="display:none" name="ppp" id="ppp">
|
612 |
|
<td colspan="2" style="padding:0px;">
|
613 |
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
614 |
|
<tr>
|
615 |
|
<td colspan="2" valign="top" class="listtopic">PPP configuration</td>
|
616 |
|
</tr>
|
617 |
|
<tr>
|
618 |
|
<td width="22%" valign="top" class="vncell">Init String</td>
|
619 |
|
<td width="78%" class="vtable">
|
620 |
|
<input type="text" size="40" class="formfld unknown" id="initstr" name="initstr" value="<?=htmlspecialchars($pconfig['initstr']);?>">
|
621 |
|
<br/><span class="vexpl">Note: Enter the modem initialization string here. Do NOT include the "AT" string at the beginning of the command. Many modern USB 3G
|
622 |
|
modems don't need an initialization string.</span>
|
623 |
|
</td>
|
624 |
|
</tr>
|
625 |
|
<tr>
|
626 |
|
<td width="22%" valign="top" class="vncell">Sim PIN</td>
|
627 |
|
<td width="78%" class="vtable">
|
628 |
|
<input name="simpin" type="text" class="formfld unknown" id="simpin" size="12" value="<?=htmlspecialchars($pconfig['simpin']);?>">
|
629 |
|
</td>
|
630 |
|
</tr>
|
631 |
|
<tr>
|
632 |
|
<td width="22%" valign="top" class="vncell">Sim PIN wait</td>
|
633 |
|
<td width="78%" class="vtable">
|
634 |
|
<input name="pin-wait" type="text" class="formfld unknown" id="pin-wait" size="2" value="<?=htmlspecialchars($pconfig['pin-wait']);?>">
|
635 |
|
<br/><span class="vexpl">Note: Time to wait for SIM to discover network after PIN is sent to SIM (seconds).</span>
|
636 |
|
</td>
|
637 |
|
</tr>
|
638 |
|
<tr>
|
639 |
|
<td width="22%" valign="top" class="vncell">Access Point Name (APN)</td>
|
640 |
|
<td width="78%" class="vtable">
|
641 |
|
<input name="apn" type="text" class="formfld unknown" id="apn" size="40" value="<?=htmlspecialchars($pconfig['apn']);?>">
|
642 |
|
</td>
|
643 |
|
</tr>
|
644 |
|
<tr>
|
645 |
|
<td width="22%" valign="top" class="vncell">APN number (optional)</td>
|
646 |
|
<td width="78%" class="vtable">
|
647 |
|
<input name="apnum" type="text" class="formfld unknown" id="apnum" size="2" value="<?=htmlspecialchars($pconfig['apnum']);?>">
|
648 |
|
<br/><span class="vexpl">Note: Defaults to 1 if you set APN above. Ignored if you set no APN above.</span>
|
649 |
|
</td>
|
650 |
|
</tr>
|
651 |
|
<tr>
|
652 |
|
<td width="22%" valign="top" class="vncell">Phone Number</td>
|
653 |
|
<td width="78%" class="vtable">
|
654 |
|
<input name="phone" type="text" class="formfld unknown" id="phone" size="40" value="<?=htmlspecialchars($pconfig['phone']);?>">
|
655 |
|
<br/><span class="vexpl">Note: Typically (*99# or *99***# or *99***1#) for GSM networks and *777 for CDMA networks</span>
|
656 |
|
</td>
|
657 |
|
</tr>
|
658 |
|
<tr>
|
659 |
|
<td width="22%" valign="top" class="vncell">Connection Timeout</td>
|
660 |
|
<td width="78%" class="vtable">
|
661 |
|
<input name="connect-timeout" type="text" class="formfld unknown" id="connect-timeout" size="2" value="<?=htmlspecialchars($pconfig['connect-timeout']);?>">
|
662 |
|
<br/><span class="vexpl">Note: Enter timeout in seconds for connection to be established (sec.) Default is 45 sec.</span>
|
663 |
|
</td>
|
664 |
|
</tr>
|
665 |
|
</table>
|
666 |
|
</td>
|
667 |
|
</tr>
|
668 |
|
<tr style="display:none" name="pppoe" id="pppoe">
|
669 |
|
<td colspan="2" style="padding:0px;">
|
670 |
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
671 |
|
<tr>
|
672 |
|
<td colspan="2" valign="top" class="listtopic">PPPoE configuration</td>
|
673 |
|
</tr>
|
674 |
|
<tr>
|
675 |
|
<td width="22%" valign="top" class="vncell">Service name</td>
|
676 |
|
<td width="78%" class="vtable"><input name="provider" type="text" class="formfld unknown" id="provider" size="20" value="<?=htmlspecialchars($pconfig['provider']);?>">
|
677 |
|
<br/> <span class="vexpl">Hint: this field can usually be left empty</span>
|
678 |
|
</td>
|
679 |
|
</tr>
|
680 |
|
<tr>
|
681 |
|
<td width="22%" valign="top" class="vncell"><?=gettext("Periodic reset");?></td>
|
682 |
|
<td width="78%" class="vtable">
|
683 |
|
<input name="pppoe_preset" type="checkbox" id="pppoe_preset" value="yes" <?php if ($pconfig['pppoe_preset']) echo "checked"; ?> onclick="show_more_settings(this,presetwrap);" />
|
684 |
|
<?= gettext("enable periodic PPPoE resets"); ?>
|
685 |
|
<br />
|
686 |
|
<?php if ($pconfig['pppoe_preset']): ?>
|
687 |
|
<table id="presetwrap" cellspacing="0" cellpadding="0" width="100%">
|
688 |
|
<?php else: ?>
|
689 |
|
<table id="presetwrap" cellspacing="0" cellpadding="0" width="100%" style="display: none;">
|
690 |
|
<?php endif; ?>
|
691 |
|
<tr>
|
692 |
|
<td align="left" valign="top">
|
693 |
|
<p style="margin: 4px; padding: 4px 0 4px 0; width: 94%;">
|
694 |
|
<input name="pppoe_pr_type" type="radio" id="pppoe_pr_custom" value="custom" <?php if ($pconfig['pppoe_pr_custom']) echo "checked=\"checked\""; ?> onclick="if (this.checked) { Effect.Appear('pppoecustomwrap', { duration: 0.0 }); Effect.Fade('pppoepresetwrap', { duration: 0.0 }); }" />
|
695 |
|
<?= gettext("provide a custom reset time"); ?>
|
696 |
|
<br />
|
697 |
|
<input name="pppoe_pr_type" type="radio" id="pppoe_pr_preset" value="preset" <?php if ($pconfig['pppoe_pr_preset']) echo "checked=\"checked\""; ?> onclick="if (this.checked) { Effect.Appear('pppoepresetwrap', { duration: 0.0 }); Effect.Fade('pppoecustomwrap', { duration: 0.0 }); }" />
|
698 |
|
<?= gettext("select reset time from a preset"); ?>
|
699 |
|
</p>
|
700 |
|
<?php if ($pconfig['pppoe_pr_custom']): ?>
|
701 |
|
<p style="margin: 2px; padding: 4px; width: 94%;" id="pppoecustomwrap">
|
702 |
|
<?php else: ?>
|
703 |
|
<p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoecustomwrap">
|
704 |
|
<?php endif; ?>
|
705 |
|
<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" />
|
706 |
|
<?= gettext("hour (0-23)"); ?><br />
|
707 |
|
<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" />
|
708 |
|
<?= gettext("minute (0-59)"); ?><br />
|
709 |
|
<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']);?>" />
|
710 |
|
<?= gettext("reset at a specific date (mm/dd/yyyy)"); ?>
|
711 |
|
<br /> <br />
|
712 |
|
<span class="red"><strong>Note: </strong></span>
|
713 |
|
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.
|
714 |
|
</p>
|
715 |
|
<?php if ($pconfig['pppoe_pr_preset']): ?>
|
716 |
|
<p style="margin: 2px; padding: 4px; width: 94%;" id="pppoepresetwrap">
|
717 |
|
<?php else: ?>
|
718 |
|
<p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoepresetwrap">
|
719 |
|
<?php endif; ?>
|
720 |
|
<input name="pppoe_pr_preset_val" type="radio" id="pppoe_monthly" value="monthly" <?php if ($pconfig['pppoe_monthly']) echo "checked=\"checked\""; ?> />
|
721 |
|
<?= gettext("reset at each month ('0 0 1 * *')"); ?>
|
722 |
|
<br />
|
723 |
|
<input name="pppoe_pr_preset_val" type="radio" id="pppoe_weekly" value="weekly" <?php if ($pconfig['pppoe_weekly']) echo "checked=\"checked\""; ?> />
|
724 |
|
<?= gettext("reset at each week ('0 0 * * 0')"); ?>
|
725 |
|
<br />
|
726 |
|
<input name="pppoe_pr_preset_val" type="radio" id="pppoe_daily" value="daily" <?php if ($pconfig['pppoe_daily']) echo "checked=\"checked\""; ?> />
|
727 |
|
<?= gettext("reset at each day ('0 0 * * *')"); ?>
|
728 |
|
<br />
|
729 |
|
<input name="pppoe_pr_preset_val" type="radio" id="pppoe_hourly" value="hourly" <?php if ($pconfig['pppoe_hourly']) echo "checked=\"checked\""; ?> />
|
730 |
|
<?= gettext("reset at each hour ('0 * * * *')"); ?>
|
731 |
|
</p>
|
732 |
|
</td>
|
733 |
|
</tr>
|
734 |
|
</table>
|
735 |
|
</td>
|
736 |
|
</tr>
|
737 |
|
</table>
|
738 |
|
</td>
|
739 |
|
</tr>
|
740 |
|
<tr style="display:none" name="pptp" id="pptp">
|
741 |
|
<td colspan="2" style="padding:0px;">
|
742 |
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
743 |
|
<tr>
|
744 |
|
<td colspan="2" valign="top" class="listtopic">PPTP configuration</td>
|
745 |
|
</tr>
|
746 |
|
</table>
|
747 |
|
</td>
|
748 |
|
</tr>
|
749 |
|
<tr style="display:none" id="ipfields">
|
750 |
|
<td colspan="2" style="padding:0px;">
|
751 |
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
752 |
|
<tr>
|
753 |
|
<td width="22%" valign="top" class="vncell">Local IP address</td>
|
754 |
|
<td width="78%" class="vtable">
|
755 |
|
<input name="localip" type="text" class="formfld unknown" id="localip" size="20" value="<?=htmlspecialchars($pconfig['localip']);?>">
|
756 |
|
/
|
757 |
|
<select style="display:none" name="subnet" class="formselect" id="subnet">
|
758 |
|
<?php for ($i = 31; $i > 0; $i--): ?>
|
759 |
|
<option value="<?=$i;?>"<?php if ($i == $pconfig['subnet']) echo "selected"; ?>><?=$i;?></option>
|
760 |
|
<?php endfor; ?>
|
761 |
|
</select>
|
762 |
|
<br><span class="vexpl">Note: Local IP/subnet is required for PPTP connections. LocalIP is automatically assigned for PPP links if this field is empty.</span>
|
763 |
|
</td>
|
764 |
|
</tr>
|
765 |
|
<tr>
|
766 |
|
<td width="22%" valign="top" class="vncell">Remote IP (Gateway)</td>
|
767 |
|
<td width="78%" class="vtable">
|
768 |
|
<input name="gateway" type="text" class="formfld unknown" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>">
|
769 |
|
<br><span class="vexpl">Note: This is where the packets will be routed. Remote IP is required for PPTP connections. Remote IP is automatically assigned for PPP links if this field is empty.</span>
|
770 |
|
</td>
|
771 |
|
</tr>
|
772 |
|
</table>
|
773 |
|
</td>
|
774 |
|
<tr>
|
775 |
|
<td colspan="2" valign="top" height="16"></td>
|
776 |
|
</tr>
|
777 |
|
<tr>
|
778 |
|
<td colspan="2" valign="top" class="listtopic">Advanced Options</td>
|
779 |
|
</tr>
|
780 |
|
<tr>
|
781 |
|
<td width="22%" valign="top" class="vncell">Compression</td>
|
782 |
|
<td width="78%" class="vtable">
|
783 |
|
<input type="checkbox" value="on" id="vjcomp" name="vjcomp" <?php if (isset($pconfig['vjcomp'])) echo "checked"; ?>> Enable vjcomp(compression).
|
784 |
|
<br/> <span class="vexpl">This option enables Van Jacobson TCP header compression, which saves several bytes per TCP data packet.
|
785 |
|
You almost always want this option. This compression ineffective for TCP connections with enabled modern extensions like time
|
786 |
|
stamping or SACK, which modify TCP options between sequential packets.</span>
|
787 |
|
</td>
|
788 |
|
</tr>
|
789 |
|
<tr>
|
790 |
|
<td width="22%" valign="top" class="vncell">TCPmssFix</td>
|
791 |
|
<td width="78%" class="vtable">
|
792 |
|
<input type="checkbox" value="on" id="tcpmssfix" name="tcpmssfix" <?php if (isset($pconfig['tcpmssfix'])) echo "checked"; ?>> Enable tcpmssfix.
|
793 |
|
<br/> <span class="vexpl">This option causes mpd to adjust incoming and outgoing TCP SYN segments so that the requested maximum segment size is not greater than the amount
|
794 |
|
allowed by the interface MTU. This is necessary in many setups to avoid problems caused by routers that drop ICMP Datagram Too Big messages. Without these messages,
|
795 |
|
the originating machine sends data, it passes the rogue router then hits a machine that has an MTU that is not big enough for the data. Because the IP Don't Fragment option is set,
|
796 |
|
this machine sends an ICMP Datagram Too Big message back to the originator and drops the packet. The rogue router drops the ICMP message and the originator never
|
797 |
|
gets to discover that it must reduce the fragment size or drop the IP Don't Fragment option from its outgoing data.</span>
|
798 |
|
</td>
|
799 |
|
</tr>
|
800 |
|
<tr>
|
801 |
|
<td width="22%" valign="top" class="vncell">ShortSeq</td>
|
802 |
|
<td width="78%" class="vtable">
|
803 |
|
<input type="checkbox" value="on" id="shortseq" name="shortseq" <?php if (isset($pconfig['shortseq'])) echo "checked"; ?>> Enable shortseq.
|
804 |
|
<br/> <span class="vexpl">This option is only meaningful if multi-link PPP is negotiated. It proscribes shorter multi-link fragment headers, saving two bytes on every frame.</span>
|
805 |
|
</td>
|
806 |
|
</tr>
|
807 |
|
<tr>
|
808 |
|
<td width="22%" valign="top" class="vncell">ACFComp</td>
|
809 |
|
<td width="78%" class="vtable">
|
810 |
|
<input type="checkbox" value="on" id="acfcomp" name="acfcomp" <?php if (isset($pconfig['acfcomp'])) echo "checked"; ?>> Enable acfcomp.
|
811 |
|
<br/> <span class="vexpl">Address and control field compression. This option only applies to asynchronous link types. It saves two bytes per frame.</span>
|
812 |
|
</td>
|
813 |
|
</tr>
|
814 |
|
<tr>
|
815 |
|
<td width="22%" valign="top" class="vncell">ProtoComp</td>
|
816 |
|
<td width="78%" class="vtable">
|
817 |
|
<input type="checkbox" value="on" id="protocomp" name="protocomp" <?php if (isset($pconfig['protocomp'])) echo "checked"; ?>> Enable protocomp(compression).
|
818 |
|
<br/> <span class="vexpl">Protocol field compression. This option saves one byte per frame for most frames.</span>
|
819 |
|
</td>
|
820 |
|
</tr>
|
821 |
|
|
822 |
|
<?php for($i=0; $i < $port_count; $i++) : ?>
|
823 |
|
<tr style="display:none" id="link<?=$i;?>">
|
824 |
|
<td width="22%" valign="top" id="linklabel<?=$i;?>" class="vncell"> Link Parameters</td>
|
825 |
|
<td class="vtable">
|
826 |
|
<table name="link_parameters" border="0" cellpadding="6" cellspacing="0">
|
827 |
|
<tr>
|
828 |
|
<td width="22%" valign="top" id="bandwidth<?=$i;?>" class="vncell"> Bandwidth</td>
|
829 |
|
<td width="78%" class="vtable">
|
830 |
|
<br/><input name="bandwidth[]" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['bandwidth'][$i]);?>">
|
831 |
|
<br/> <span class="vexpl">Set Bandwidth for each link ONLY when links have different bandwidths.</span>
|
832 |
|
</td>
|
833 |
|
</tr>
|
834 |
|
<tr>
|
835 |
|
<td width="22%" valign="top" id="mtu<?=$i;?>" class="vncell"> MTU</td>
|
836 |
|
<td width="78%" class="vtable">
|
837 |
|
<input name="mtu[]" type="text" class="formfld unknown" size="6" value="<?=htmlspecialchars($pconfig['mtu'][$i]);?>">
|
838 |
|
<br> <span class="vexpl">Set MTU for each link if links have different bandwidths, otherwise, mtu will default to 1492.</span>
|
839 |
|
</td>
|
840 |
|
</tr>
|
841 |
|
<tr>
|
842 |
|
<td width="22%" valign="top" id="mru<?=$i;?>" class="vncell"> MRU</td>
|
843 |
|
<td width="78%" class="vtable">
|
844 |
|
<input name="mru[]" type="text" class="formfld unknown" size="6" value="<?=htmlspecialchars($pconfig['mru'][$i]);?>">
|
845 |
|
<br> <span class="vexpl">Set MRU for each link if links have different bandwidths, otherwise, mru will default to 1492.</span>
|
846 |
|
</td>
|
847 |
|
</tr>
|
848 |
|
</table
|
849 |
|
</td>
|
850 |
|
</tr>
|
851 |
|
<?php endfor; ?>
|
852 |
|
<tr>
|
853 |
|
<td width="22%" valign="top"> </td>
|
854 |
|
<td width="78%">
|
855 |
|
<input name="Submit" type="submit" class="formbtn" value="Save">
|
856 |
|
<input type="button" value="Cancel" onclick="history.back()">
|
857 |
|
<?php if (isset($id) && $a_ppps[$id]): ?>
|
858 |
|
<input name="id" type="hidden" value="<?=$id;?>">
|
859 |
|
<?php endif; ?>
|
860 |
|
</td>
|
861 |
|
</tr>
|
862 |
|
</table>
|
863 |
|
</form>
|
864 |
|
<?php include("fend.inc"); ?>
|
865 |
|
</body>
|
866 |
|
</html>
|
Use "PPPs" as the new Tab name in Interfaces -> Assign. Rename files and update affected files.
Also, add upgrade_config function 062_to_063.