Project

General

Profile

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