Project

General

Profile

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