1 |
589f92bb
|
gnhb
|
<?php
|
2 |
|
|
/* $Id$ */
|
3 |
|
|
/*
|
4 |
42809b4a
|
gnhb
|
interfaces_ppps_edit.php
|
5 |
589f92bb
|
gnhb
|
part of m0n0wall (http://m0n0.ch/wall)
|
6 |
|
|
|
7 |
|
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
8 |
|
|
All rights reserved.
|
9 |
80bc7a5c
|
gnhb
|
Copyright (C) 2010 Gabriel B. <gnoahb@gmail.com>.
|
10 |
|
|
All rights reserved.
|
11 |
589f92bb
|
gnhb
|
|
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 |
42809b4a
|
gnhb
|
##|*IDENT=page-interfaces-ppps-edit
|
39 |
|
|
##|*NAME=Interfaces: PPPs: Edit page
|
40 |
|
|
##|*DESCR=Allow access to the 'Interfaces: PPPs: Edit' page.
|
41 |
|
|
##|*MATCH=interfaces_ppps_edit.php*
|
42 |
589f92bb
|
gnhb
|
##|-PRIV
|
43 |
|
|
|
44 |
|
|
require("guiconfig.inc");
|
45 |
00b702cc
|
gnhb
|
require("functions.inc");
|
46 |
589f92bb
|
gnhb
|
|
47 |
76d9c58d
|
gnhb
|
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 |
e51cea69
|
gnhb
|
|
52 |
0810c115
|
gnhb
|
if (!is_array($config['ppps']['ppp']))
|
53 |
|
|
$config['ppps']['ppp'] = array();
|
54 |
|
|
|
55 |
|
|
$a_ppps = &$config['ppps']['ppp'];
|
56 |
|
|
|
57 |
01c201e3
|
Ermal
|
$iflist = get_configured_interface_with_descr();
|
58 |
0810c115
|
gnhb
|
$portlist = get_interface_list();
|
59 |
01c201e3
|
Ermal
|
$portlist = array_merge($portlist, $iflist);
|
60 |
76d9c58d
|
gnhb
|
|
61 |
589f92bb
|
gnhb
|
$id = $_GET['id'];
|
62 |
|
|
if (isset($_POST['id']))
|
63 |
|
|
$id = $_POST['id'];
|
64 |
e5d558bf
|
gnhb
|
|
65 |
80bc7a5c
|
gnhb
|
if (isset($id) && $a_ppps[$id]) {
|
66 |
e5d558bf
|
gnhb
|
$pconfig['ptpid'] = $a_ppps[$id]['ptpid'];
|
67 |
80bc7a5c
|
gnhb
|
$pconfig['type'] = $a_ppps[$id]['type'];
|
68 |
e5d558bf
|
gnhb
|
//$pconfig['if'] = $a_ppps[$id]['if'];
|
69 |
2a3e31a2
|
gnhb
|
$pconfig['interfaces'] = $a_ppps[$id]['ports'];
|
70 |
047ae6ab
|
gnhb
|
$pconfig['username'] = $a_ppps[$id]['username'];
|
71 |
91a5b98a
|
gnhb
|
$pconfig['password'] = base64_decode($a_ppps[$id]['password']);
|
72 |
76d9c58d
|
gnhb
|
if (isset($a_ppps[$id]['ondemand']))
|
73 |
e51cea69
|
gnhb
|
$pconfig['ondemand'] = true;
|
74 |
76d9c58d
|
gnhb
|
$pconfig['idletimeout'] = $a_ppps[$id]['idletimeout'];
|
75 |
2a3e31a2
|
gnhb
|
$pconfig['uptime'] = $a_ppps[$id]['uptime'];
|
76 |
80bc7a5c
|
gnhb
|
$pconfig['descr'] = $a_ppps[$id]['descr'];
|
77 |
de77ffdb
|
gnhb
|
$pconfig['bandwidth'] = explode(",",$a_ppps[$id]['bandwidth']);
|
78 |
|
|
$pconfig['mtu'] = explode(",",$a_ppps[$id]['mtu']);
|
79 |
|
|
$pconfig['mru'] = explode(",",$a_ppps[$id]['mru']);
|
80 |
6a30f701
|
gnhb
|
$pconfig['mrru'] = explode(",",$a_ppps[$id]['mrru']);
|
81 |
76d9c58d
|
gnhb
|
if (isset($a_ppps[$id]['shortseq']))
|
82 |
|
|
$pconfig['shortseq'] = true;
|
83 |
|
|
if (isset($a_ppps[$id]['acfcomp']))
|
84 |
|
|
$pconfig['acfcomp'] = true;
|
85 |
|
|
if (isset($a_ppps[$id]['protocomp']))
|
86 |
|
|
$pconfig['protocomp'] = true;
|
87 |
e51cea69
|
gnhb
|
if (isset($a_ppps[$id]['vjcomp']))
|
88 |
|
|
$pconfig['vjcomp'] = true;
|
89 |
|
|
if (isset($a_ppps[$id]['tcpmssfix']))
|
90 |
|
|
$pconfig['tcpmssfix'] = true;
|
91 |
114990f4
|
gnhb
|
switch($a_ppps[$id]['type']) {
|
92 |
|
|
case "ppp":
|
93 |
|
|
$pconfig['initstr'] = base64_decode($a_ppps[$id]['initstr']);
|
94 |
|
|
$pconfig['simpin'] = $a_ppps[$id]['simpin'];
|
95 |
|
|
$pconfig['pin-wait'] = $a_ppps[$id]['pin-wait'];
|
96 |
|
|
$pconfig['apn'] = $a_ppps[$id]['apn'];
|
97 |
|
|
$pconfig['apnum'] = $a_ppps[$id]['apnum'];
|
98 |
|
|
$pconfig['phone'] = $a_ppps[$id]['phone'];
|
99 |
|
|
$pconfig['connect-timeout'] = $a_ppps[$id]['connect-timeout'];
|
100 |
|
|
$pconfig['localip'] = explode(",",$a_ppps[$id]['localip']);
|
101 |
|
|
$pconfig['gateway'] = explode(",",$a_ppps[$id]['gateway']);
|
102 |
|
|
break;
|
103 |
d6366dd7
|
gnhb
|
case "l2tp":
|
104 |
114990f4
|
gnhb
|
case "pptp":
|
105 |
|
|
$pconfig['localip'] = explode(",",$a_ppps[$id]['localip']);
|
106 |
|
|
$pconfig['subnet'] = explode(",",$a_ppps[$id]['subnet']);
|
107 |
|
|
$pconfig['gateway'] = explode(",",$a_ppps[$id]['gateway']);
|
108 |
|
|
case "pppoe":
|
109 |
|
|
$pconfig['provider'] = $a_ppps[$id]['provider'];
|
110 |
c6667396
|
gnhb
|
if (isset($a_ppps[$id]['provider']) and empty($a_ppps[$id]['provider']))
|
111 |
|
|
$pconfig['null_service'] = true;
|
112 |
114990f4
|
gnhb
|
/* ================================================ */
|
113 |
|
|
/* = force a connection reset at a specific time? = */
|
114 |
|
|
/* ================================================ */
|
115 |
e40e6724
|
gnhb
|
|
116 |
114990f4
|
gnhb
|
if (isset($a_ppps[$id]['pppoe-reset-type'])) {
|
117 |
|
|
$pconfig['pppoe-reset-type'] = $a_ppps[$id]['pppoe-reset-type'];
|
118 |
e5d558bf
|
gnhb
|
$itemhash = getMPDCRONSettings($a_ppps[$id]['if']);
|
119 |
114990f4
|
gnhb
|
$cronitem = $itemhash['ITEM'];
|
120 |
|
|
if (isset($cronitem)) {
|
121 |
|
|
$resetTime = "{$cronitem['minute']} {$cronitem['hour']} {$cronitem['mday']} {$cronitem['month']} {$cronitem['wday']}";
|
122 |
|
|
} else {
|
123 |
|
|
$resetTime = NULL;
|
124 |
|
|
}
|
125 |
|
|
|
126 |
|
|
if ($a_ppps[$id]['pppoe-reset-type'] == "custom") {
|
127 |
cfbfd941
|
smos
|
$resetTime_a = explode(" ", $resetTime);
|
128 |
114990f4
|
gnhb
|
$pconfig['pppoe_pr_custom'] = true;
|
129 |
|
|
$pconfig['pppoe_resetminute'] = $resetTime_a[0];
|
130 |
|
|
$pconfig['pppoe_resethour'] = $resetTime_a[1];
|
131 |
|
|
/* just initialize $pconfig['pppoe_resetdate'] if the
|
132 |
|
|
* coresponding item contains appropriate numeric values.
|
133 |
|
|
*/
|
134 |
|
|
if ($resetTime_a[2] <> "*" && $resetTime_a[3] <> "*")
|
135 |
|
|
$pconfig['pppoe_resetdate'] = "{$resetTime_a[3]}/{$resetTime_a[2]}/" . date("Y");
|
136 |
|
|
} else if ($a_ppps[$id]['pppoe-reset-type'] == "preset") {
|
137 |
|
|
$pconfig['pppoe_pr_preset'] = true;
|
138 |
|
|
switch ($resetTime) {
|
139 |
|
|
case CRON_MONTHLY_PATTERN:
|
140 |
|
|
$pconfig['pppoe_monthly'] = true;
|
141 |
|
|
break;
|
142 |
|
|
case CRON_WEEKLY_PATTERN:
|
143 |
|
|
$pconfig['pppoe_weekly'] = true;
|
144 |
|
|
break;
|
145 |
|
|
case CRON_DAILY_PATTERN:
|
146 |
|
|
$pconfig['pppoe_daily'] = true;
|
147 |
|
|
break;
|
148 |
|
|
case CRON_HOURLY_PATTERN:
|
149 |
|
|
$pconfig['pppoe_hourly'] = true;
|
150 |
|
|
break;
|
151 |
|
|
}
|
152 |
80bc7a5c
|
gnhb
|
}
|
153 |
|
|
}
|
154 |
114990f4
|
gnhb
|
break;
|
155 |
e51cea69
|
gnhb
|
}
|
156 |
|
|
|
157 |
e5d558bf
|
gnhb
|
} else
|
158 |
|
|
$pconfig['ptpid'] = interfaces_ptpid_next();
|
159 |
589f92bb
|
gnhb
|
|
160 |
|
|
if ($_POST) {
|
161 |
|
|
|
162 |
|
|
unset($input_errors);
|
163 |
|
|
$pconfig = $_POST;
|
164 |
80bc7a5c
|
gnhb
|
|
165 |
|
|
/* okay first of all, cause we are just hiding the PPPoE HTML
|
166 |
|
|
* fields releated to PPPoE resets, we are going to unset $_POST
|
167 |
|
|
* vars, if the reset feature should not be used. Otherwise the
|
168 |
|
|
* data validation procedure below, may trigger a false error
|
169 |
|
|
* message.
|
170 |
|
|
*/
|
171 |
04d36b1f
|
gnhb
|
if (empty($_POST['pppoe-reset-type'])) {
|
172 |
80bc7a5c
|
gnhb
|
unset($_POST['pppoe_resethour']);
|
173 |
|
|
unset($_POST['pppoe_resetminute']);
|
174 |
|
|
unset($_POST['pppoe_resetdate']);
|
175 |
|
|
unset($_POST['pppoe_pr_preset_val']);
|
176 |
|
|
}
|
177 |
589f92bb
|
gnhb
|
|
178 |
c9797064
|
gnhb
|
/* input validation */
|
179 |
80bc7a5c
|
gnhb
|
switch($_POST['type']) {
|
180 |
76d9c58d
|
gnhb
|
case "ppp":
|
181 |
5833e715
|
Erik Fonnesbeck
|
$reqdfields = explode(" ", "interfaces phone");
|
182 |
2f5cfc85
|
Rafael Lucas
|
$reqdfieldsn = array(gettext("Link Interface(s)"),gettext("Phone Number"));
|
183 |
80bc7a5c
|
gnhb
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
184 |
|
|
break;
|
185 |
76d9c58d
|
gnhb
|
case "pppoe":
|
186 |
80bc7a5c
|
gnhb
|
if ($_POST['ondemand']) {
|
187 |
047ae6ab
|
gnhb
|
$reqdfields = explode(" ", "interfaces username password ondemand idletimeout");
|
188 |
2f5cfc85
|
Rafael Lucas
|
$reqdfieldsn = array(gettext("Link Interface(s)"),gettext("Username"),gettext("Password"),gettext("Dial on demand"),gettext("Idle timeout value"));
|
189 |
80bc7a5c
|
gnhb
|
} else {
|
190 |
047ae6ab
|
gnhb
|
$reqdfields = explode(" ", "interfaces username password");
|
191 |
2f5cfc85
|
Rafael Lucas
|
$reqdfieldsn = array(gettext("Link Interface(s)"),gettext("Username"),gettext("Password"));
|
192 |
80bc7a5c
|
gnhb
|
}
|
193 |
|
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
194 |
|
|
break;
|
195 |
041b35cc
|
gnhb
|
case "l2tp":
|
196 |
76d9c58d
|
gnhb
|
case "pptp":
|
197 |
80bc7a5c
|
gnhb
|
if ($_POST['ondemand']) {
|
198 |
047ae6ab
|
gnhb
|
$reqdfields = explode(" ", "interfaces username password localip subnet gateway ondemand idletimeout");
|
199 |
2f5cfc85
|
Rafael Lucas
|
$reqdfieldsn = array(gettext("Link Interface(s)"),gettext("Username"),gettext("Password"),gettext("Local IP address"),gettext("Subnet"),gettext("Remote IP address"),gettext("Dial on demand"),gettext("Idle timeout value"));
|
200 |
80bc7a5c
|
gnhb
|
} else {
|
201 |
047ae6ab
|
gnhb
|
$reqdfields = explode(" ", "interfaces username password localip subnet gateway");
|
202 |
2f5cfc85
|
Rafael Lucas
|
$reqdfieldsn = array(gettext("Link Interface(s)"),gettext("Username"),gettext("Password"),gettext("Local IP address"),gettext("Subnet"),gettext("Remote IP address"));
|
203 |
80bc7a5c
|
gnhb
|
}
|
204 |
|
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
205 |
|
|
break;
|
206 |
76d9c58d
|
gnhb
|
default:
|
207 |
2f5cfc85
|
Rafael Lucas
|
$input_errors[] = gettext("Please choose a Link Type.");
|
208 |
76d9c58d
|
gnhb
|
break;
|
209 |
589f92bb
|
gnhb
|
}
|
210 |
42809b4a
|
gnhb
|
if ($_POST['type'] == "ppp" && count($_POST['interfaces']) > 1)
|
211 |
2f5cfc85
|
Rafael Lucas
|
$input_errors[] = gettext("Multilink connections (MLPPP) using the PPP link type is not currently supported. Please select only one Link Interface.");
|
212 |
03184eda
|
gnhb
|
if ($_POST['provider'] && !is_domain($_POST['provider']))
|
213 |
|
|
$input_errors[] = gettext("The Service name contains invalid characters.");
|
214 |
|
|
if ($_POST['provider'] && $_POST['null_service'])
|
215 |
|
|
$input_errors[] = gettext("Do not specify both a Service name and a NULL Service name.");
|
216 |
80bc7a5c
|
gnhb
|
if (($_POST['idletimeout'] != "") && !is_numericint($_POST['idletimeout']))
|
217 |
2f5cfc85
|
Rafael Lucas
|
$input_errors[] = gettext("The idle timeout value must be an integer.");
|
218 |
a986f97f
|
gnhb
|
if ($_POST['pppoe-reset-type'] == "custom" && $_POST['pppoe_resethour'] <> "" && !is_numericint($_POST['pppoe_resethour']) &&
|
219 |
80bc7a5c
|
gnhb
|
$_POST['pppoe_resethour'] >= 0 && $_POST['pppoe_resethour'] <=23)
|
220 |
|
|
$input_errors[] = gettext("A valid PPPoE reset hour must be specified (0-23).");
|
221 |
a986f97f
|
gnhb
|
if ($_POST['pppoe-reset-type'] == "custom" && $_POST['pppoe_resetminute'] <> "" && !is_numericint($_POST['pppoe_resetminute']) &&
|
222 |
80bc7a5c
|
gnhb
|
$_POST['pppoe_resetminute'] >= 0 && $_POST['pppoe_resetminute'] <=59)
|
223 |
|
|
$input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59).");
|
224 |
a986f97f
|
gnhb
|
if ($_POST['pppoe-reset-type'] == "custom" && $_POST['pppoe_resetdate'] <> "" && !is_numeric(str_replace("/", "", $_POST['pppoe_resetdate'])))
|
225 |
80bc7a5c
|
gnhb
|
$input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy).");
|
226 |
a986f97f
|
gnhb
|
if ($_POST['pppoe-reset-type'] == "custom" && $_POST['pppoe_resetdate'] <> "" && is_numeric(str_replace("/", "", $_POST['pppoe_resetdate']))){
|
227 |
|
|
$date_nums = explode("/",$_POST['pppoe_resetdate']);
|
228 |
|
|
if ($date_nums[0] < 1 || $date_nums[0] > 12)
|
229 |
|
|
$input_errors[] = gettext("A valid PPPoE reset month must be specified (1-12) in the Custom PPPoE Periodic reset fields.");
|
230 |
|
|
if ($date_nums[1] < 1 || $date_nums[1] > 31)
|
231 |
|
|
$input_errors[] = gettext("A valid PPPoE reset day of month must be specified (1-31) in the Custom PPPoE Periodic reset fields. No checks are done on valid # of days per month");
|
232 |
|
|
if ($date_nums[2] < date("Y"))
|
233 |
|
|
$input_errors[] = gettext("A valid PPPoE reset year must be specified. Don't select a year in the past!");
|
234 |
|
|
}
|
235 |
0661b194
|
gnhb
|
|
236 |
|
|
foreach($_POST['interfaces'] as $iface){
|
237 |
|
|
if ($_POST['localip'][$iface] && !is_ipaddr($_POST['localip'][$iface]))
|
238 |
2f5cfc85
|
Rafael Lucas
|
$input_errors[] = sprintf(gettext("A valid local IP address must be specified for %s."),$iface);
|
239 |
114990f4
|
gnhb
|
if ($_POST['gateway'][$iface] && !is_ipaddr($_POST['gateway'][$iface]) && !is_hostname($_POST['gateway'][$iface]))
|
240 |
2f5cfc85
|
Rafael Lucas
|
$input_errors[] = sprintf(gettext("A valid gateway IP address OR hostname must be specified for %s."),$iface);
|
241 |
114990f4
|
gnhb
|
if ($_POST['bandwidth'][$iface] && !is_numericint($_POST['bandwidth'][$iface]))
|
242 |
2f5cfc85
|
Rafael Lucas
|
$input_errors[] = sprintf(gettext("The bandwidth value for %s must be an integer."),$iface);
|
243 |
0661b194
|
gnhb
|
if ($_POST['mtu'][$iface] && ($_POST['mtu'][$iface] < 576))
|
244 |
2f5cfc85
|
Rafael Lucas
|
$input_errors[] = sprintf(gettext("The MTU for %s must be greater than 576 bytes."),$iface);
|
245 |
0661b194
|
gnhb
|
if ($_POST['mru'][$iface] && ($_POST['mru'][$iface] < 576))
|
246 |
2f5cfc85
|
Rafael Lucas
|
$input_errors[] = sprintf(gettext("The MRU for %s must be greater than 576 bytes."),$iface);
|
247 |
0661b194
|
gnhb
|
}
|
248 |
c9797064
|
gnhb
|
|
249 |
e51cea69
|
gnhb
|
/*
|
250 |
80bc7a5c
|
gnhb
|
foreach ($a_ppps as $ppp) {
|
251 |
|
|
if (isset($id) && ($a_ppps[$id]) && ($a_ppps[$id] === $ppp))
|
252 |
589f92bb
|
gnhb
|
continue;
|
253 |
|
|
|
254 |
80bc7a5c
|
gnhb
|
if ($ppp['serialport'] == $_POST['serialport']) {
|
255 |
e51cea69
|
gnhb
|
$input_errors[] = "Serial port is in use";
|
256 |
589f92bb
|
gnhb
|
break;
|
257 |
|
|
}
|
258 |
|
|
}
|
259 |
e51cea69
|
gnhb
|
*/
|
260 |
589f92bb
|
gnhb
|
|
261 |
|
|
if (!$input_errors) {
|
262 |
80bc7a5c
|
gnhb
|
$ppp = array();
|
263 |
42809b4a
|
gnhb
|
$ppp['ptpid'] = $_POST['ptpid'];
|
264 |
80bc7a5c
|
gnhb
|
$ppp['type'] = $_POST['type'];
|
265 |
e5d558bf
|
gnhb
|
$ppp['if'] = $ppp['type'].$ppp['ptpid'];
|
266 |
64d124c5
|
gnhb
|
$ppp['ports'] = implode(',',$_POST['interfaces']);
|
267 |
047ae6ab
|
gnhb
|
$ppp['username'] = $_POST['username'];
|
268 |
91a5b98a
|
gnhb
|
$ppp['password'] = base64_encode($_POST['password']);
|
269 |
76d9c58d
|
gnhb
|
$ppp['ondemand'] = $_POST['ondemand'] ? true : false;
|
270 |
|
|
if (!empty($_POST['idletimeout']))
|
271 |
|
|
$ppp['idletimeout'] = $_POST['idletimeout'];
|
272 |
04d36b1f
|
gnhb
|
else
|
273 |
|
|
unset($ppp['idletimeout']);
|
274 |
2a3e31a2
|
gnhb
|
$ppp['uptime'] = $_POST['uptime'] ? true : false;
|
275 |
76d9c58d
|
gnhb
|
if (!empty($_POST['descr']))
|
276 |
|
|
$ppp['descr'] = $_POST['descr'];
|
277 |
|
|
else
|
278 |
|
|
unset($ppp['descr']);
|
279 |
cb37d8fa
|
gnhb
|
|
280 |
09637075
|
gnhb
|
// Loop through fields associated with a individual link/port and make an array of the data
|
281 |
|
|
$port_fields = array("localip", "gateway", "subnet", "bandwidth", "mtu", "mru", "mrru");
|
282 |
|
|
foreach($_POST['interfaces'] as $iface){
|
283 |
|
|
foreach($port_fields as $field_label){
|
284 |
|
|
if (isset($_POST[$field_label][$iface]))
|
285 |
|
|
$port_data[$field_label][] = $_POST[$field_label][$iface];
|
286 |
|
|
}
|
287 |
|
|
}
|
288 |
|
|
|
289 |
80bc7a5c
|
gnhb
|
switch($_POST['type']) {
|
290 |
|
|
case "ppp":
|
291 |
|
|
if (!empty($_POST['initstr']))
|
292 |
|
|
$ppp['initstr'] = base64_encode($_POST['initstr']);
|
293 |
|
|
else
|
294 |
|
|
unset($ppp['initstr']);
|
295 |
|
|
if (!empty($_POST['simpin'])) {
|
296 |
|
|
$ppp['simpin'] = $_POST['simpin'];
|
297 |
|
|
$ppp['pin-wait'] = $_POST['pin-wait'];
|
298 |
|
|
} else {
|
299 |
|
|
unset($ppp['simpin']);
|
300 |
|
|
unset($ppp['pin-wait']);
|
301 |
|
|
}
|
302 |
589f92bb
|
gnhb
|
|
303 |
80bc7a5c
|
gnhb
|
if (!empty($_POST['apn'])){
|
304 |
|
|
$ppp['apn'] = $_POST['apn'];
|
305 |
3a906378
|
gnhb
|
$ppp['apnum'] = $_POST['apnum'];
|
306 |
80bc7a5c
|
gnhb
|
} else {
|
307 |
|
|
unset($ppp['apn']);
|
308 |
|
|
unset($ppp['apnum']);
|
309 |
|
|
}
|
310 |
e51cea69
|
gnhb
|
$ppp['phone'] = $_POST['phone'];
|
311 |
09637075
|
gnhb
|
$ppp['localip'] = implode(',',$port_data['localip']);
|
312 |
|
|
$ppp['gateway'] = implode(',',$port_data['gateway']);
|
313 |
80bc7a5c
|
gnhb
|
if (!empty($_POST['connect-timeout']))
|
314 |
|
|
$ppp['connect-timeout'] = $_POST['connect-timeout'];
|
315 |
|
|
else
|
316 |
|
|
unset($ppp['connect-timeout']);
|
317 |
|
|
break;
|
318 |
|
|
case "pppoe":
|
319 |
e51cea69
|
gnhb
|
if (!empty($_POST['provider']))
|
320 |
|
|
$ppp['provider'] = $_POST['provider'];
|
321 |
03184eda
|
gnhb
|
else{
|
322 |
e51cea69
|
gnhb
|
unset($ppp['provider']);
|
323 |
03184eda
|
gnhb
|
$ppp['provider'] = $_POST['null_service'] ? true : false;
|
324 |
|
|
}
|
325 |
a986f97f
|
gnhb
|
if (!empty($_POST['pppoe-reset-type']))
|
326 |
|
|
$ppp['pppoe-reset-type'] = $_POST['pppoe-reset-type'];
|
327 |
|
|
else
|
328 |
|
|
unset($ppp['pppoe-reset-type']);
|
329 |
766bd6d0
|
gnhb
|
|
330 |
80bc7a5c
|
gnhb
|
break;
|
331 |
|
|
case "pptp":
|
332 |
114990f4
|
gnhb
|
case "l2tp":
|
333 |
09637075
|
gnhb
|
$ppp['localip'] = implode(',',$port_data['localip']);
|
334 |
|
|
$ppp['subnet'] = implode(',',$port_data['subnet']);
|
335 |
|
|
$ppp['gateway'] = implode(',',$port_data['gateway']);
|
336 |
80bc7a5c
|
gnhb
|
break;
|
337 |
76d9c58d
|
gnhb
|
default:
|
338 |
|
|
break;
|
339 |
|
|
|
340 |
589f92bb
|
gnhb
|
}
|
341 |
766bd6d0
|
gnhb
|
|
342 |
76d9c58d
|
gnhb
|
$ppp['shortseq'] = $_POST['shortseq'] ? true : false;
|
343 |
|
|
$ppp['acfcomp'] = $_POST['acfcomp'] ? true : false;
|
344 |
|
|
$ppp['protocomp'] = $_POST['protocomp'] ? true : false;
|
345 |
e51cea69
|
gnhb
|
$ppp['vjcomp'] = $_POST['vjcomp'] ? true : false;
|
346 |
|
|
$ppp['tcpmssfix'] = $_POST['tcpmssfix'] ? true : false;
|
347 |
09637075
|
gnhb
|
$ppp['bandwidth'] = implode(',', $port_data['bandwidth']);
|
348 |
d80a71d9
|
Ermal
|
if (is_array($port_data['mtu']))
|
349 |
|
|
$ppp['mtu'] = implode(',', $port_data['mtu']);
|
350 |
|
|
if (is_array($port_data['mru']))
|
351 |
|
|
$ppp['mru'] = implode(',', $port_data['mru']);
|
352 |
|
|
if (is_array($port_data['mrru']))
|
353 |
|
|
$ppp['mrru'] = implode(',', $port_data['mrru']);
|
354 |
09637075
|
gnhb
|
|
355 |
766bd6d0
|
gnhb
|
/* handle_pppoe_reset is called here because if user changes Link Type from PPPoE to another type we
|
356 |
|
|
must be able to clear the config data in the <cron> section of config.xml if it exists
|
357 |
|
|
*/
|
358 |
e5d558bf
|
gnhb
|
handle_pppoe_reset($_POST);
|
359 |
01c201e3
|
Ermal
|
|
360 |
80bc7a5c
|
gnhb
|
if (isset($id) && $a_ppps[$id])
|
361 |
|
|
$a_ppps[$id] = $ppp;
|
362 |
|
|
else
|
363 |
|
|
$a_ppps[] = $ppp;
|
364 |
01c201e3
|
Ermal
|
|
365 |
80bc7a5c
|
gnhb
|
write_config();
|
366 |
3f2ef8d7
|
gnhb
|
configure_cron();
|
367 |
01c201e3
|
Ermal
|
|
368 |
|
|
foreach ($iflist as $pppif => $ifdescr) {
|
369 |
|
|
if ($config['interfaces'][$if]['if'] == $ppp['if'])
|
370 |
|
|
interface_ppps_configure($pppif);
|
371 |
42809b4a
|
gnhb
|
}
|
372 |
|
|
header("Location: interfaces_ppps.php");
|
373 |
80bc7a5c
|
gnhb
|
exit;
|
374 |
589f92bb
|
gnhb
|
}
|
375 |
76d9c58d
|
gnhb
|
} // end if($_POST)
|
376 |
|
|
|
377 |
4b32eb9d
|
gnhb
|
$closehead = false;
|
378 |
2f5cfc85
|
Rafael Lucas
|
$pgtitle = array(gettext("Interfaces"),gettext("PPPs"),gettext("Edit"));
|
379 |
589f92bb
|
gnhb
|
include("head.inc");
|
380 |
4b32eb9d
|
gnhb
|
|
381 |
2f5cfc85
|
Rafael Lucas
|
$types = array("select" => gettext("Select"), "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" => "PPTP", "l2tp" => "L2TP"/*, "tcp" => "TCP", "udp" => "UDP"*/ );
|
382 |
589f92bb
|
gnhb
|
|
383 |
|
|
?>
|
384 |
00b702cc
|
gnhb
|
<script type="text/javascript" src="/javascript/numericupdown/js/numericupdown.js"></script>
|
385 |
|
|
<link href="/javascript/numericupdown/css/numericupdown.css" rel="stylesheet" type="text/css" />
|
386 |
|
|
<script type="text/javascript" src="/javascript/datepicker/js/datepicker.js"></script>
|
387 |
|
|
<link href="/javascript/datepicker/css/datepicker.css" rel="stylesheet" type="text/css"/>
|
388 |
c9797064
|
gnhb
|
<script type="text/javascript" >
|
389 |
bef629ac
|
Vinicius Coque
|
jQuery(document).ready(function() { updateType(<?php echo "'{$pconfig['type']}'";?>); });
|
390 |
c9797064
|
gnhb
|
</script>
|
391 |
4b32eb9d
|
gnhb
|
</head>
|
392 |
76d9c58d
|
gnhb
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" >
|
393 |
589f92bb
|
gnhb
|
<?php include("fbegin.inc"); ?>
|
394 |
|
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
395 |
42809b4a
|
gnhb
|
<form action="interfaces_ppps_edit.php" method="post" name="iform" id="iform">
|
396 |
91a5b98a
|
gnhb
|
<table id="interfacetable" width="100%" border="0" cellpadding="6" cellspacing="0">
|
397 |
|
|
<tr>
|
398 |
a986f97f
|
gnhb
|
<td colspan="2" valign="top" class="listtopic"><?= gettext("PPPs configuration"); ?></td>
|
399 |
91a5b98a
|
gnhb
|
</tr>
|
400 |
|
|
<tr>
|
401 |
a986f97f
|
gnhb
|
<td valign="middle" class="vncell"><strong><?= gettext("Link Type"); ?></strong></td>
|
402 |
91a5b98a
|
gnhb
|
<td class="vtable">
|
403 |
c9797064
|
gnhb
|
<select name="type" onChange="updateType(this.value);" class="formselect" id="type">
|
404 |
91a5b98a
|
gnhb
|
<?php
|
405 |
|
|
foreach ($types as $key => $opt) {
|
406 |
|
|
echo "<option onClick=\"updateType('{$key}');\"";
|
407 |
|
|
if ($key == $pconfig['type'])
|
408 |
|
|
echo " selected";
|
409 |
|
|
echo " value=\"{$key}\" >" . htmlspecialchars($opt) . "</option>";
|
410 |
|
|
}
|
411 |
|
|
?>
|
412 |
3a906378
|
gnhb
|
</select>
|
413 |
91a5b98a
|
gnhb
|
</td>
|
414 |
|
|
</tr>
|
415 |
|
|
<tr name="interface" id="interface" >
|
416 |
a986f97f
|
gnhb
|
<td width="22%" valign="top" class="vncellreq"><?= gettext("Link interface(s)"); ?></td>
|
417 |
91a5b98a
|
gnhb
|
<td width="78%" class="vtable">
|
418 |
00b702cc
|
gnhb
|
<select valign="top" name="interfaces[]" multiple="true" class="formselect" size="4" onChange="show_hide_linkfields(this.options);">
|
419 |
91a5b98a
|
gnhb
|
<option></option>
|
420 |
|
|
</select>
|
421 |
0810c115
|
gnhb
|
|
422 |
c5232cbb
|
gnhb
|
<br/><span class="vexpl"><?= gettext("Select at least two interfaces for Multilink (MLPPP) connections."); ?></span>
|
423 |
91a5b98a
|
gnhb
|
</td>
|
424 |
|
|
</tr>
|
425 |
|
|
<tr style="display:none" name="portlists" id="portlists">
|
426 |
|
|
<td id="serialports"><?php
|
427 |
64d124c5
|
gnhb
|
$selected_ports = explode(',',$pconfig['interfaces']);
|
428 |
55d8298a
|
Ermal
|
if (!is_dir("/var/spool/lock"))
|
429 |
|
|
mwexec("/bin/mkdir -p /var/spool/lock");
|
430 |
5cb5063c
|
Ermal
|
$serialports = pfSense_get_modem_devices();
|
431 |
de77ffdb
|
gnhb
|
$serport_count = 0;
|
432 |
c9797064
|
gnhb
|
foreach ($serialports as $port) {
|
433 |
de77ffdb
|
gnhb
|
$serport_count++;
|
434 |
c9797064
|
gnhb
|
echo $port.",".trim($port);
|
435 |
|
|
if (in_array($port,$selected_ports))
|
436 |
|
|
echo ",1|";
|
437 |
|
|
else
|
438 |
|
|
echo ",|";
|
439 |
|
|
}
|
440 |
de77ffdb
|
gnhb
|
echo $serport_count;
|
441 |
91a5b98a
|
gnhb
|
?></td>
|
442 |
|
|
<td id="ports"><?php
|
443 |
de77ffdb
|
gnhb
|
$port_count = 0;
|
444 |
c9797064
|
gnhb
|
foreach ($portlist as $ifn => $ifinfo){
|
445 |
de77ffdb
|
gnhb
|
$port_count++;
|
446 |
8d73e7a9
|
Ermal
|
$string = "";
|
447 |
|
|
if (is_array($ifinfo)) {
|
448 |
|
|
$string .= $ifn;
|
449 |
|
|
if ($ifinfo['mac'])
|
450 |
|
|
$string .= " ({$ifinfo['mac']})";
|
451 |
|
|
} else
|
452 |
|
|
$string .= $ifinfo;
|
453 |
|
|
$string .= ",{$ifn}";
|
454 |
|
|
echo htmlspecialchars($string);
|
455 |
64d124c5
|
gnhb
|
if (in_array($ifn,$selected_ports))
|
456 |
c9797064
|
gnhb
|
echo ",1|";
|
457 |
|
|
else
|
458 |
|
|
echo ",|";
|
459 |
|
|
}
|
460 |
de77ffdb
|
gnhb
|
echo $port_count;
|
461 |
0810c115
|
gnhb
|
if($serport_count > $port_count)
|
462 |
|
|
$port_count=$serport_count;
|
463 |
91a5b98a
|
gnhb
|
?></td>
|
464 |
114990f4
|
gnhb
|
<td style="display:none" name="port_count" id="port_count"><?=htmlspecialchars($port_count);?></td>
|
465 |
91a5b98a
|
gnhb
|
</tr>
|
466 |
7db2ef5f
|
gnhb
|
<tr>
|
467 |
|
|
<td width="22%" valign="top" class="vncell"><?= gettext("Description"); ?></td>
|
468 |
|
|
<td width="78%" class="vtable">
|
469 |
|
|
<input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>">
|
470 |
|
|
<br/> <span class="vexpl"><?= gettext("You may enter a description here for your reference. Description will appear in the \"Interfaces Assign\" select lists."); ?></span>
|
471 |
|
|
</td>
|
472 |
|
|
</tr>
|
473 |
|
|
<tr style="display:none" name="select" id="select"></tr>
|
474 |
|
|
|
475 |
|
|
<?php $k=0; ?>
|
476 |
|
|
|
477 |
|
|
<tr style="display:none" name="ppp_provider" id="ppp_provider">
|
478 |
|
|
<td width="22%" valign="top" class="vncell"><?= gettext("Service Provider"); ?></td>
|
479 |
|
|
<td width="78%" class="vtable">
|
480 |
|
|
<table border="0" cellpadding="0" cellspacing="0">
|
481 |
|
|
<tr id="trcountry" style="display:none">
|
482 |
82a1d978
|
Vinicius Coque
|
<td><?= gettext("Country:"); ?> </td>
|
483 |
7db2ef5f
|
gnhb
|
<td>
|
484 |
|
|
<select class="formselect" name="country" id="country" onChange="providers_list()">
|
485 |
|
|
<option></option>
|
486 |
|
|
</select>
|
487 |
|
|
</td>
|
488 |
|
|
</tr>
|
489 |
|
|
<tr id="trprovider" style="display:none">
|
490 |
82a1d978
|
Vinicius Coque
|
<td><?= gettext("Provider:"); ?> </td>
|
491 |
7db2ef5f
|
gnhb
|
<td>
|
492 |
|
|
<select class="formselect" name="provider" id="provider" onChange="providerplan_list()">
|
493 |
|
|
<option></option>
|
494 |
|
|
</select>
|
495 |
|
|
</td>
|
496 |
|
|
</tr>
|
497 |
|
|
<tr id="trproviderplan" style="display:none">
|
498 |
82a1d978
|
Vinicius Coque
|
<td><?= gettext("Plan:"); ?> </td>
|
499 |
7db2ef5f
|
gnhb
|
<td>
|
500 |
|
|
<select class="formselect" name="providerplan" id="providerplan" onChange="prefill_provider()">
|
501 |
|
|
<option></option>
|
502 |
|
|
</select>
|
503 |
|
|
</td>
|
504 |
|
|
</tr>
|
505 |
|
|
</table>
|
506 |
|
|
<br/><span class="vexpl"><?= gettext("Select to fill in data for your service provider."); ?></span>
|
507 |
|
|
</td>
|
508 |
|
|
</tr>
|
509 |
91a5b98a
|
gnhb
|
<tr>
|
510 |
a986f97f
|
gnhb
|
<td width="22%" valign="top" class="vncell"><?= gettext("Username"); ?></td>
|
511 |
91a5b98a
|
gnhb
|
<td width="78%" class="vtable">
|
512 |
00b702cc
|
gnhb
|
<input name="username" type="text" class="formfld user" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>">
|
513 |
91a5b98a
|
gnhb
|
</td>
|
514 |
|
|
</tr>
|
515 |
|
|
<tr>
|
516 |
a986f97f
|
gnhb
|
<td width="22%" valign="top" class="vncell"><?= gettext("Password"); ?></td>
|
517 |
91a5b98a
|
gnhb
|
<td width="78%" class="vtable">
|
518 |
|
|
<input name="password" type="password" class="formfld pwd" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>">
|
519 |
|
|
</td>
|
520 |
|
|
</tr>
|
521 |
7db2ef5f
|
gnhb
|
|
522 |
|
|
<tr style="display:none" name="phone_num" id="phone_num">
|
523 |
|
|
<td width="22%" valign="top" class="vncell"><?= gettext("Phone Number"); ?></td>
|
524 |
91a5b98a
|
gnhb
|
<td width="78%" class="vtable">
|
525 |
7db2ef5f
|
gnhb
|
<input name="phone" type="text" class="formfld unknown" id="phone" size="40" value="<?=htmlspecialchars($pconfig['phone']);?>">
|
526 |
7d04e4ac
|
Chris Buechler
|
<br/><span class="vexpl"><?= gettext("Note: Typically *99# for GSM networks and #777 for CDMA networks"); ?></span>
|
527 |
91a5b98a
|
gnhb
|
</td>
|
528 |
|
|
</tr>
|
529 |
cac14686
|
gnhb
|
<tr style="display:none" name="apn_" id="apn_">
|
530 |
7db2ef5f
|
gnhb
|
<td width="22%" valign="top" class="vncell"><?= gettext("Access Point Name (APN)"); ?></td>
|
531 |
|
|
<td width="78%" class="vtable">
|
532 |
|
|
<input name="apn" type="text" class="formfld unknown" id="apn" size="40" value="<?=htmlspecialchars($pconfig['apn']);?>">
|
533 |
|
|
</td>
|
534 |
91a5b98a
|
gnhb
|
</tr>
|
535 |
c5232cbb
|
gnhb
|
|
536 |
91a5b98a
|
gnhb
|
<tr style="display:none" name="ppp" id="ppp">
|
537 |
|
|
<td colspan="2" style="padding:0px;">
|
538 |
7db2ef5f
|
gnhb
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
539 |
|
|
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
|
540 |
c5232cbb
|
gnhb
|
<td width="22%" valign="top" class="vncell"><?= gettext("APN number (optional)"); ?></td>
|
541 |
|
|
<td width="78%" class="vtable">
|
542 |
|
|
<input name="apnum" type="text" class="formfld unknown" id="apnum" size="2" value="<?=htmlspecialchars($pconfig['apnum']);?>">
|
543 |
|
|
<br/><span class="vexpl"><?= gettext("Note: Defaults to 1 if you set APN above. Ignored if you set no APN above."); ?></span>
|
544 |
|
|
</td>
|
545 |
91a5b98a
|
gnhb
|
</tr>
|
546 |
7db2ef5f
|
gnhb
|
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
|
547 |
9bca7494
|
Chris Buechler
|
<td width="22%" valign="top" class="vncell"><?= gettext("SIM PIN"); ?></td>
|
548 |
c5232cbb
|
gnhb
|
<td width="78%" class="vtable">
|
549 |
|
|
<input name="simpin" type="text" class="formfld unknown" id="simpin" size="12" value="<?=htmlspecialchars($pconfig['simpin']);?>">
|
550 |
|
|
</td>
|
551 |
91a5b98a
|
gnhb
|
</tr>
|
552 |
7db2ef5f
|
gnhb
|
|
553 |
|
|
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
|
554 |
9bca7494
|
Chris Buechler
|
<td width="22%" valign="top" class="vncell"><?= gettext("SIM PIN wait"); ?></td>
|
555 |
c5232cbb
|
gnhb
|
<td width="78%" class="vtable">
|
556 |
|
|
<input name="pin-wait" type="text" class="formfld unknown" id="pin-wait" size="2" value="<?=htmlspecialchars($pconfig['pin-wait']);?>">
|
557 |
|
|
<br/><span class="vexpl"><?= gettext("Note: Time to wait for SIM to discover network after PIN is sent to SIM (seconds)."); ?></span>
|
558 |
|
|
</td>
|
559 |
91a5b98a
|
gnhb
|
</tr>
|
560 |
c5232cbb
|
gnhb
|
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
|
561 |
|
|
<td width="22%" valign="top" class="vncell"><?= gettext("Init String"); ?></td>
|
562 |
|
|
<td width="78%" class="vtable">
|
563 |
|
|
<input type="text" size="40" class="formfld unknown" id="initstr" name="initstr" value="<?=htmlspecialchars($pconfig['initstr']);?>">
|
564 |
499c22cd
|
Carlos Eduardo Ramos
|
<br/><span class="vexpl"><?= gettext("Note: Enter the modem initialization string here. Do NOT include the \"AT\"" .
|
565 |
4f3147bc
|
Chris Buechler
|
" string at the beginning of the command. Many modern USB 3G modems don't need an initialization string."); ?></span>
|
566 |
c5232cbb
|
gnhb
|
</td>
|
567 |
|
|
</tr>
|
568 |
|
|
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
|
569 |
a986f97f
|
gnhb
|
<td width="22%" valign="top" class="vncell"><?= gettext("Connection Timeout"); ?></td>
|
570 |
91a5b98a
|
gnhb
|
<td width="78%" class="vtable">
|
571 |
|
|
<input name="connect-timeout" type="text" class="formfld unknown" id="connect-timeout" size="2" value="<?=htmlspecialchars($pconfig['connect-timeout']);?>">
|
572 |
a986f97f
|
gnhb
|
<br/><span class="vexpl"><?= gettext("Note: Enter timeout in seconds for connection to be established (sec.) Default is 45 sec."); ?></span>
|
573 |
91a5b98a
|
gnhb
|
</td>
|
574 |
|
|
</tr>
|
575 |
c5232cbb
|
gnhb
|
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
|
576 |
|
|
<td valign="top" class="vncell"><?= gettext("Uptime Logging"); ?></td>
|
577 |
|
|
<td class="vtable">
|
578 |
|
|
<input type="checkbox" value="on" id="uptime" name="uptime" <?php if (isset($pconfig['uptime'])) echo "checked"; ?>> <?= gettext("Enable persistent logging of connection uptime."); ?>
|
579 |
|
|
<br/> <span class="vexpl"><?= gettext("This option causes cumulative uptime to be recorded and displayed on the Status Interfaces page."); ?></span>
|
580 |
|
|
</td>
|
581 |
|
|
</tr>
|
582 |
91a5b98a
|
gnhb
|
</table>
|
583 |
|
|
</td>
|
584 |
|
|
</tr>
|
585 |
|
|
<tr style="display:none" name="pppoe" id="pppoe">
|
586 |
|
|
<td colspan="2" style="padding:0px;">
|
587 |
|
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
588 |
|
|
<tr>
|
589 |
a986f97f
|
gnhb
|
<td width="22%" valign="top" class="vncell"><?= gettext("Service name"); ?></td>
|
590 |
c6667396
|
gnhb
|
<td width="78%" class="vtable"><input name="provider" type="text" class="formfld unknown" id="provider" size="20" value="<?=htmlspecialchars($pconfig['provider']);?>">
|
591 |
515c6799
|
gnhb
|
<input type="checkbox" value="on" id="null_service" name="null_service" <?php if (isset($pconfig['null_service'])) echo "checked"; ?>> <?= gettext("Configure a NULL Service name"); ?>
|
592 |
298d49f6
|
gnhb
|
<br/> <span class="vexpl"><?= gettext("Hint: this field can usually be left empty. Service name will not be configured if this field is empty. Check the \"Configure NULL\" box to configure a blank Service name."); ?></span>
|
593 |
91a5b98a
|
gnhb
|
</td>
|
594 |
|
|
</tr>
|
595 |
3a906378
|
gnhb
|
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
|
596 |
91a5b98a
|
gnhb
|
<td width="22%" valign="top" class="vncell"><?=gettext("Periodic reset");?></td>
|
597 |
|
|
<td width="78%" class="vtable">
|
598 |
|
|
<table id="presetwrap" cellspacing="0" cellpadding="0" width="100%">
|
599 |
|
|
<tr>
|
600 |
|
|
<td align="left" valign="top">
|
601 |
|
|
<p style="margin: 4px; padding: 4px 0 4px 0; width: 94%;">
|
602 |
a986f97f
|
gnhb
|
<select valign="top" id="reset_type" name="pppoe-reset-type" class="formselect" onChange="show_reset_settings(this.value);">
|
603 |
0810c115
|
gnhb
|
<option value = ""><?= gettext("Disabled"); ?></option>
|
604 |
|
|
<option value="custom" <?php if ($pconfig['pppoe-reset-type'] == "custom") echo "selected"; ?>><?= gettext("Custom"); ?></option>
|
605 |
|
|
<option value="preset" <?php if ($pconfig['pppoe-reset-type'] == "preset") echo "selected"; ?>><?= gettext("Pre-Set"); ?></option>
|
606 |
a986f97f
|
gnhb
|
</select> <?= gettext("Select a reset timing type"); ?>
|
607 |
|
|
</p>
|
608 |
|
|
<?php if ($pconfig['pppoe_pr_custom']): ?>
|
609 |
|
|
<p style="margin: 2px; padding: 4px; width: 94%;" id="pppoecustomwrap">
|
610 |
|
|
<?php else: ?>
|
611 |
|
|
<p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoecustomwrap">
|
612 |
|
|
<?php endif; ?>
|
613 |
|
|
<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" />
|
614 |
|
|
<?= gettext("hour (0-23)"); ?><br />
|
615 |
|
|
<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" />
|
616 |
|
|
<?= gettext("minute (0-59)"); ?><br />
|
617 |
|
|
<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']);?>" />
|
618 |
|
|
<?= gettext("reset at a specific date (mm/dd/yyyy)"); ?>
|
619 |
|
|
<br /> <br />
|
620 |
82a1d978
|
Vinicius Coque
|
<span class="red"><strong><?=gettext("Note:");?></strong></span>
|
621 |
a986f97f
|
gnhb
|
<?= gettext("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."); ?>
|
622 |
|
|
</p>
|
623 |
|
|
<?php if ($pconfig['pppoe_pr_preset']): ?>
|
624 |
|
|
<p style="margin: 2px; padding: 4px; width: 94%;" id="pppoepresetwrap">
|
625 |
|
|
<?php else: ?>
|
626 |
|
|
<p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoepresetwrap">
|
627 |
|
|
<?php endif; ?>
|
628 |
|
|
<input name="pppoe_pr_preset_val" type="radio" id="pppoe_monthly" value="monthly" <?php if ($pconfig['pppoe_monthly']) echo "checked=\"checked\""; ?> />
|
629 |
|
|
<?= gettext("reset at each month ('0 0 1 * *')"); ?>
|
630 |
|
|
<br />
|
631 |
|
|
<input name="pppoe_pr_preset_val" type="radio" id="pppoe_weekly" value="weekly" <?php if ($pconfig['pppoe_weekly']) echo "checked=\"checked\""; ?> />
|
632 |
|
|
<?= gettext("reset at each week ('0 0 * * 0')"); ?>
|
633 |
|
|
<br />
|
634 |
|
|
<input name="pppoe_pr_preset_val" type="radio" id="pppoe_daily" value="daily" <?php if ($pconfig['pppoe_daily']) echo "checked=\"checked\""; ?> />
|
635 |
|
|
<?= gettext("reset at each day ('0 0 * * *')"); ?>
|
636 |
|
|
<br />
|
637 |
|
|
<input name="pppoe_pr_preset_val" type="radio" id="pppoe_hourly" value="hourly" <?php if ($pconfig['pppoe_hourly']) echo "checked=\"checked\""; ?> />
|
638 |
|
|
<?= gettext("reset at each hour ('0 * * * *')"); ?>
|
639 |
|
|
</p>
|
640 |
91a5b98a
|
gnhb
|
</td>
|
641 |
|
|
</tr>
|
642 |
|
|
</table>
|
643 |
|
|
</td>
|
644 |
|
|
</tr>
|
645 |
|
|
</table>
|
646 |
|
|
</td>
|
647 |
|
|
</tr>
|
648 |
7db2ef5f
|
gnhb
|
|
649 |
|
|
<?php for($j=0; $j < $port_count; $j++) : ?>
|
650 |
|
|
|
651 |
|
|
<tr style="display:none" id="gw_fields<?=$j;?>">
|
652 |
|
|
<td width="22%" id="localiplabel<?=$j;?>" valign="top" class="vncell"><?= gettext("Local IP"); ?></td>
|
653 |
|
|
<td width="78%" class="vtable">
|
654 |
|
|
<input name="localip[]" type="text" class="formfld unknown" id="localip<?=$j;?>" size="20" value="<?=htmlspecialchars($pconfig['localip'][$j]);?>">
|
655 |
|
|
/
|
656 |
|
|
<select name="subnet[]" class="formselect" id="subnet<?=$j;?>" disabled="true">
|
657 |
|
|
<?php for ($i = 31; $i > 0; $i--): ?>
|
658 |
|
|
<option value="<?=$i;?>"<?php if ($i == $pconfig['subnet'][$j]) echo " selected"; ?>><?=$i;?></option>
|
659 |
|
|
<?php endfor; ?>
|
660 |
ced4df74
|
gnhb
|
</select> <?= gettext("IP Address"); ?>
|
661 |
cac14686
|
gnhb
|
|
662 |
91a5b98a
|
gnhb
|
</td>
|
663 |
|
|
</tr>
|
664 |
7db2ef5f
|
gnhb
|
<tr style="display:none" id="ip_fields<?=$j;?>">
|
665 |
|
|
<td width="22%" id="gatewaylabel<?=$j;?>" valign="top" class="vncell"></td>
|
666 |
|
|
<td width="78%" class="vtable">
|
667 |
|
|
<input name="gateway[]" type="text" class="formfld unknown" id="gateway<?=$j;?>" size="20" value="<?=htmlspecialchars($pconfig['gateway'][$j]);?>"><?= gettext("IP Address OR Hostname"); ?>
|
668 |
91a5b98a
|
gnhb
|
</td>
|
669 |
0661b194
|
gnhb
|
</tr><?php endfor; ?>
|
670 |
c5232cbb
|
gnhb
|
|
671 |
|
|
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
|
672 |
91a5b98a
|
gnhb
|
<td colspan="2" valign="top" height="16"></td>
|
673 |
|
|
</tr>
|
674 |
c5232cbb
|
gnhb
|
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
|
675 |
a986f97f
|
gnhb
|
<td colspan="2" valign="top" class="listtopic"><?= gettext("Advanced Options"); ?></td>
|
676 |
91a5b98a
|
gnhb
|
</tr>
|
677 |
c5232cbb
|
gnhb
|
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
|
678 |
|
|
<td valign="top" class="vncell"><?= gettext("Dial On Demand"); ?></td>
|
679 |
|
|
<td class="vtable">
|
680 |
|
|
<input type="checkbox" value="on" id="ondemand" name="ondemand" <?php if (isset($pconfig['ondemand'])) echo "checked"; ?>> <?= gettext("Enable Dial-on-Demand mode"); ?>
|
681 |
0eaf7055
|
gnhb
|
<br/> <span class="vexpl"><?= gettext("This option causes the interface to operate in dial-on-demand mode. Do NOT enable if you want your link to be always up. " .
|
682 |
499c22cd
|
Carlos Eduardo Ramos
|
"The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected."); ?> </span>
|
683 |
c5232cbb
|
gnhb
|
</td>
|
684 |
|
|
</tr>
|
685 |
|
|
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
|
686 |
|
|
<td valign="top" class="vncell"><?= gettext("Idle Timeout"); ?></td>
|
687 |
|
|
<td class="vtable">
|
688 |
|
|
<input name="idletimeout" type="text" class="formfld unknown" id="idletimeout" size="12" value="<?=htmlspecialchars($pconfig['idletimeout']);?>"> <?= gettext("(seconds) Default is 0, which disables the timeout feature."); ?>
|
689 |
2f5cfc85
|
Rafael Lucas
|
<br/> <span class="vexpl"><?= gettext("If no incoming or outgoing packets are transmitted for the entered number of seconds the connection is brought down.");?>
|
690 |
|
|
<br/><?=gettext("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>
|
691 |
c5232cbb
|
gnhb
|
</td>
|
692 |
|
|
</tr>
|
693 |
|
|
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
|
694 |
a986f97f
|
gnhb
|
<td width="22%" valign="top" class="vncell"><?= gettext("Compression"); ?></td>
|
695 |
91a5b98a
|
gnhb
|
<td width="78%" class="vtable">
|
696 |
4a1ee8ac
|
gnhb
|
<input type="checkbox" value="on" id="vjcomp" name="vjcomp" <?php if (isset($pconfig['vjcomp'])) echo "checked"; ?>> <?= gettext("Disable vjcomp(compression) (auto-negotiated by default)."); ?>
|
697 |
499c22cd
|
Carlos Eduardo Ramos
|
<br/> <span class="vexpl"><?=gettext("This option enables Van Jacobson TCP header compression, which saves several bytes per TCP data packet. " .
|
698 |
|
|
"You almost always want this option. This compression ineffective for TCP connections with enabled modern extensions like time " .
|
699 |
|
|
"stamping or SACK, which modify TCP options between sequential packets.");?></span>
|
700 |
91a5b98a
|
gnhb
|
</td>
|
701 |
|
|
</tr>
|
702 |
c5232cbb
|
gnhb
|
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
|
703 |
a986f97f
|
gnhb
|
<td width="22%" valign="top" class="vncell"><?= gettext("TCPmssFix"); ?></td>
|
704 |
91a5b98a
|
gnhb
|
<td width="78%" class="vtable">
|
705 |
8adc1e49
|
gnhb
|
<input type="checkbox" value="on" id="tcpmssfix" name="tcpmssfix" <?php if (isset($pconfig['tcpmssfix'])) echo "checked"; ?>> <?= gettext("Disable tcpmssfix (enabled by default)."); ?>
|
706 |
2f5cfc85
|
Rafael Lucas
|
<br/> <span class="vexpl"><?=gettext("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 ".
|
707 |
|
|
"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, ".
|
708 |
|
|
"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, ".
|
709 |
|
|
"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 ".
|
710 |
|
|
"gets to discover that it must reduce the fragment size or drop the IP Don't Fragment option from its outgoing data.");?></span>
|
711 |
91a5b98a
|
gnhb
|
</td>
|
712 |
|
|
</tr>
|
713 |
c5232cbb
|
gnhb
|
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
|
714 |
2f5cfc85
|
Rafael Lucas
|
<td width="22%" valign="top" class="vncell"><?=gettext("ShortSeq");?></td>
|
715 |
91a5b98a
|
gnhb
|
<td width="78%" class="vtable">
|
716 |
4a1ee8ac
|
gnhb
|
<input type="checkbox" value="on" id="shortseq" name="shortseq" <?php if (isset($pconfig['shortseq'])) echo "checked"; ?>> <?= gettext("Disable shortseq (auto-negotiated by default)."); ?>
|
717 |
499c22cd
|
Carlos Eduardo Ramos
|
<br/> <span class="vexpl"><?= gettext("This option is only meaningful if multi-link PPP is negotiated. It proscribes shorter multi-link fragment headers, saving two bytes on every frame. " .
|
718 |
|
|
"It is not necessary to disable this for connections that are not multi-link."); ?></span>
|
719 |
91a5b98a
|
gnhb
|
</td>
|
720 |
|
|
</tr>
|
721 |
c5232cbb
|
gnhb
|
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
|
722 |
499c22cd
|
Carlos Eduardo Ramos
|
<td width="22%" valign="top" class="vncell"><?=gettext("ACFComp"); ?></td>
|
723 |
91a5b98a
|
gnhb
|
<td width="78%" class="vtable">
|
724 |
9e4f5592
|
Chris Buechler
|
<input type="checkbox" value="on" id="acfcomp" name="acfcomp" <?php if (isset($pconfig['acfcomp'])) echo "checked"; ?>> <?= gettext("Disable acfcomp (compression) (auto-negotiated by default)."); ?>
|
725 |
a986f97f
|
gnhb
|
<br/> <span class="vexpl"><?= gettext("Address and control field compression. This option only applies to asynchronous link types. It saves two bytes per frame."); ?></span>
|
726 |
91a5b98a
|
gnhb
|
</td>
|
727 |
|
|
</tr>
|
728 |
c5232cbb
|
gnhb
|
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
|
729 |
499c22cd
|
Carlos Eduardo Ramos
|
<td width="22%" valign="top" class="vncell"><?=gettext("ProtoComp"); ?></td>
|
730 |
91a5b98a
|
gnhb
|
<td width="78%" class="vtable">
|
731 |
9e4f5592
|
Chris Buechler
|
<input type="checkbox" value="on" id="protocomp" name="protocomp" <?php if (isset($pconfig['protocomp'])) echo "checked"; ?>> <?= gettext("Disable protocomp (compression) (auto-negotiated by default)."); ?>
|
732 |
a986f97f
|
gnhb
|
<br/> <span class="vexpl"><?= gettext("Protocol field compression. This option saves one byte per frame for most frames."); ?></span>
|
733 |
91a5b98a
|
gnhb
|
</td>
|
734 |
|
|
</tr>
|
735 |
c5232cbb
|
gnhb
|
<tr id="advanced_" name="advanced_">
|
736 |
|
|
<td> </td>
|
737 |
|
|
<td>
|
738 |
499c22cd
|
Carlos Eduardo Ramos
|
<p><input type="button" onClick="show_advanced(1)" value="<?=gettext("Show advanced options"); ?>"></p>
|
739 |
c5232cbb
|
gnhb
|
</td>
|
740 |
|
|
<td style="display:none" id="adv_rows" name="adv_rows"><?=$k;?></td>
|
741 |
|
|
<td style="display:none" id="adv_show" name="adv_show">0</td>
|
742 |
|
|
</tr>
|
743 |
|
|
<tr>
|
744 |
de77ffdb
|
gnhb
|
<?php for($i=0; $i < $port_count; $i++) : ?>
|
745 |
|
|
<tr style="display:none" id="link<?=$i;?>">
|
746 |
499c22cd
|
Carlos Eduardo Ramos
|
<td width="22%" valign="top" id="linklabel<?=$i;?>" class="vncell"> <?=gettext("Link Parameters");?></td>
|
747 |
c9797064
|
gnhb
|
<td class="vtable">
|
748 |
|
|
<table name="link_parameters" border="0" cellpadding="6" cellspacing="0">
|
749 |
|
|
<tr>
|
750 |
499c22cd
|
Carlos Eduardo Ramos
|
<td width="22%" id="bwlabel<?=$i;?>" valign="top"class="vncell"> <?=gettext("Bandwidth");?></td>
|
751 |
0661b194
|
gnhb
|
<td width="78%" class="vtable">
|
752 |
|
|
<br/><input name="bandwidth[]" id="bandwidth<?=$i;?>" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['bandwidth'][$i]);?>">
|
753 |
c6667396
|
gnhb
|
<br/> <span class="vexpl"><?=gettext("Set ONLY for MLPPP connections and ONLY when links have different bandwidths.");?></span>
|
754 |
c9797064
|
gnhb
|
</td>
|
755 |
|
|
</tr>
|
756 |
|
|
<tr>
|
757 |
499c22cd
|
Carlos Eduardo Ramos
|
<td width="22%" id="mtulabel<?=$i;?>" valign="top" class="vncell"> <?=gettext("MTU"); ?></td>
|
758 |
0661b194
|
gnhb
|
<td width="78%" class="vtable">
|
759 |
|
|
<input name="mtu[]" id="mtu<?=$i;?>" type="text" class="formfld unknown" size="6" value="<?=htmlspecialchars($pconfig['mtu'][$i]);?>">
|
760 |
2f5cfc85
|
Rafael Lucas
|
<br> <span class="vexpl"><?=gettext("MTU will default to 1492.");?></span>
|
761 |
c9797064
|
gnhb
|
</td>
|
762 |
|
|
</tr>
|
763 |
|
|
<tr>
|
764 |
499c22cd
|
Carlos Eduardo Ramos
|
<td width="22%" id="mrulabel<?=$i;?>" valign="top" class="vncell"> <?=gettext("MRU"); ?></td>
|
765 |
0661b194
|
gnhb
|
<td width="78%" class="vtable">
|
766 |
|
|
<input name="mru[]" id="mru<?=$i;?>" type="text" class="formfld unknown" size="6" value="<?=htmlspecialchars($pconfig['mru'][$i]);?>">
|
767 |
c6667396
|
gnhb
|
<br> <span class="vexpl">MRU <?=gettext("will be auto-negotiated by default.");?></span>
|
768 |
6a30f701
|
gnhb
|
</td>
|
769 |
|
|
</tr>
|
770 |
|
|
<tr>
|
771 |
|
|
<td width="22%" id="mrrulabel<?=$i;?>" valign="top" class="vncell"> <?=gettext("MRRU"); ?></td>
|
772 |
|
|
<td width="78%" class="vtable">
|
773 |
|
|
<input name="mrru[]" id="mrru<?=$i;?>" type="text" class="formfld unknown" size="6" value="<?=htmlspecialchars($pconfig['mrru'][$i]);?>">
|
774 |
c6667396
|
gnhb
|
<br> <span class="vexpl"><?=gettext("Set ONLY for MLPPP connections.");?> MRRU <?=gettext("will be auto-negotiated by default.");?></span>
|
775 |
c9797064
|
gnhb
|
</td>
|
776 |
|
|
</tr>
|
777 |
10e4d55e
|
Pierre POMES
|
</table>
|
778 |
c9797064
|
gnhb
|
</td>
|
779 |
42809b4a
|
gnhb
|
</tr><?php endfor; ?>
|
780 |
91a5b98a
|
gnhb
|
<tr>
|
781 |
|
|
<td width="22%" valign="top"> </td>
|
782 |
|
|
<td width="78%">
|
783 |
499c22cd
|
Carlos Eduardo Ramos
|
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>">
|
784 |
f5ccee7d
|
Carlos Eduardo Ramos
|
<input type="button" value="<?=gettext("Cancel"); ?>" onclick="history.back()">
|
785 |
e5d558bf
|
gnhb
|
<input name="ptpid" type="hidden" value="<?=htmlspecialchars($pconfig['ptpid']);?>">
|
786 |
91a5b98a
|
gnhb
|
<?php if (isset($id) && $a_ppps[$id]): ?>
|
787 |
225a2f0b
|
Scott Ullrich
|
<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>">
|
788 |
91a5b98a
|
gnhb
|
<?php endif; ?>
|
789 |
|
|
</td>
|
790 |
|
|
</tr>
|
791 |
|
|
</table>
|
792 |
589f92bb
|
gnhb
|
</form>
|
793 |
|
|
<?php include("fend.inc"); ?>
|
794 |
|
|
</body>
|
795 |
460b635f
|
Vinicius Coque
|
</html>
|