Project

General

Profile

Download (39.6 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	interfaces_ppps_edit.php
5
	part of m0n0wall (http://m0n0.ch/wall)
6

    
7
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
8
	All rights reserved.
9
	Copyright (C) 2010 Gabriel B. <gnoahb@gmail.com>.
10
	All rights reserved.
11

    
12
	Redistribution and use in source and binary forms, with or without
13
	modification, are permitted provided that the following conditions are met:
14

    
15
	1. Redistributions of source code must retain the above copyright notice,
16
	   this list of conditions and the following disclaimer.
17

    
18
	2. Redistributions in binary form must reproduce the above copyright
19
	   notice, this list of conditions and the following disclaimer in the
20
	   documentation and/or other materials provided with the distribution.
21

    
22
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
23
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
	POSSIBILITY OF SUCH DAMAGE.
32
*/
33
/*
34
	pfSense_MODULE:	interfaces
35
*/
36

    
37
##|+PRIV
38
##|*IDENT=page-interfaces-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
##|-PRIV
43

    
44
require("guiconfig.inc");
45
require("functions.inc");
46

    
47
define("CRON_PPPOE_CMD_FILE", "{$g['varetc_path']}/pppoe_restart_");
48
define("CRON_MONTHLY_PATTERN", "0 0 1 * *");
49
define("CRON_WEEKLY_PATTERN", "0 0 * * 0");
50
define("CRON_DAILY_PATTERN", "0 0 * * *");
51
define("CRON_HOURLY_PATTERN", "0 * * * *");
52

    
53
function getMPDCRONSettings($ptpid_) {
54
	global $config;
55
	if (is_array($config['cron']['item'])) {
56
		for ($i = 0; $i < count($config['cron']['item']); $i++) {
57
			$item = $config['cron']['item'][$i];
58
			if (strpos($item['command'], CRON_PPPOE_CMD_FILE.$ptpid_) !== false) {
59
				return array("ID" => $i, "ITEM" => $item);
60
			}
61
		}
62
	}
63
	return NULL;
64
}
65

    
66
if (!is_array($config['ppps']['ppp']))
67
	$config['ppps']['ppp'] = array();
68

    
69
$a_ppps = &$config['ppps']['ppp'];
70

    
71
$portlist = get_interface_list();
72

    
73
$id = $_GET['id'];
74
if (isset($_POST['id']))
75
	$id = $_POST['id'];
76

    
77

    
78
if (isset($id) && $a_ppps[$id]) {
79
	$pconfig['type'] = $a_ppps[$id]['type'];
80
	$pconfig['interfaces'] = $a_ppps[$id]['ports'];
81
	$pconfig['username'] = $a_ppps[$id]['username'];
82
	$pconfig['password'] = base64_decode($a_ppps[$id]['password']);
83
	if (isset($a_ppps[$id]['ondemand']))
84
		$pconfig['ondemand'] = true;
85
	$pconfig['idletimeout'] = $a_ppps[$id]['idletimeout'];
86
	$pconfig['uptime'] = $a_ppps[$id]['uptime'];
87
	$pconfig['descr'] = $a_ppps[$id]['descr'];
88
	$pconfig['bandwidth'] = explode(",",$a_ppps[$id]['bandwidth']);
89
	$pconfig['mtu'] = explode(",",$a_ppps[$id]['mtu']);
90
	$pconfig['mru'] = explode(",",$a_ppps[$id]['mru']);
91
	$pconfig['mrru'] = $a_ppps[$id]['mrru'];
92
	if (isset($a_ppps[$id]['shortseq']))
93
		$pconfig['shortseq'] = true;
94
	if (isset($a_ppps[$id]['acfcomp']))
95
		$pconfig['acfcomp'] = true;
96
	if (isset($a_ppps[$id]['protocomp']))
97
		$pconfig['protocomp'] = true;
98
	if (isset($a_ppps[$id]['vjcomp']))
99
		$pconfig['vjcomp'] = true;
100
	if (isset($a_ppps[$id]['tcpmssfix']))
101
		$pconfig['tcpmssfix'] = true;
102
	switch($a_ppps[$id]['type']) {
103
		case "ppp":
104
			$pconfig['initstr'] = base64_decode($a_ppps[$id]['initstr']);
105
			$pconfig['simpin'] = $a_ppps[$id]['simpin'];
106
			$pconfig['pin-wait'] = $a_ppps[$id]['pin-wait'];
107
			$pconfig['apn'] = $a_ppps[$id]['apn'];
108
			$pconfig['apnum'] = $a_ppps[$id]['apnum'];
109
			$pconfig['phone'] = $a_ppps[$id]['phone'];
110
			$pconfig['connect-timeout'] = $a_ppps[$id]['connect-timeout'];
111
			$pconfig['localip'] = explode(",",$a_ppps[$id]['localip']);
112
			$pconfig['gateway'] = explode(",",$a_ppps[$id]['gateway']);
113
			break;
114
		case "l2tp":
115
		case "pptp":
116
			$pconfig['localip'] = explode(",",$a_ppps[$id]['localip']);
117
			foreach ($pconfig['localip'] as $key => $value){
118
				if ($value == "dhcp")
119
					$pconfig['localip'][$key] = "";	
120
			}
121
			$pconfig['subnet'] = explode(",",$a_ppps[$id]['subnet']);
122
			$pconfig['gateway'] = explode(",",$a_ppps[$id]['gateway']);
123
			if (isset($a_ppps[$id]['dhcp']))
124
				$pconfig['pptp_dhcp'] = true;
125
			break;
126
		case "pppoe":
127
			$pconfig['provider'] = $a_ppps[$id]['provider'];
128
			/* ================================================ */
129
			/* = force a connection reset at a specific time? = */
130
			/* ================================================ */
131
			
132
			if (isset($a_ppps[$id]['pppoe-reset-type'])) {
133
				$pconfig['pppoe-reset-type'] = $a_ppps[$id]['pppoe-reset-type'];
134
				$itemhash = getMPDCRONSettings($a_ppps[$id]['ptpid']);
135
				$cronitem = $itemhash['ITEM'];
136
				if (isset($cronitem)) {
137
					$resetTime = "{$cronitem['minute']} {$cronitem['hour']} {$cronitem['mday']} {$cronitem['month']} {$cronitem['wday']}";
138
				} else {
139
					$resetTime = NULL;
140
				}
141
				
142
				if ($a_ppps[$id]['pppoe-reset-type'] == "custom") {
143
					$resetTime_a = split(" ", $resetTime);
144
					$pconfig['pppoe_pr_custom'] = true;
145
					$pconfig['pppoe_resetminute'] = $resetTime_a[0];
146
					$pconfig['pppoe_resethour'] = $resetTime_a[1];
147
					/*  just initialize $pconfig['pppoe_resetdate'] if the
148
					 *  coresponding item contains appropriate numeric values.
149
					 */
150
					if ($resetTime_a[2] <> "*" && $resetTime_a[3] <> "*") 
151
						$pconfig['pppoe_resetdate'] = "{$resetTime_a[3]}/{$resetTime_a[2]}/" . date("Y");
152
				} else if ($a_ppps[$id]['pppoe-reset-type'] == "preset") {
153
					$pconfig['pppoe_pr_preset'] = true;
154
					switch ($resetTime) {
155
						case CRON_MONTHLY_PATTERN:
156
							$pconfig['pppoe_monthly'] = true;
157
							break;
158
						case CRON_WEEKLY_PATTERN:
159
							$pconfig['pppoe_weekly'] = true;
160
							break;
161
						case CRON_DAILY_PATTERN:
162
							$pconfig['pppoe_daily'] = true;
163
							break;
164
						case CRON_HOURLY_PATTERN:
165
							$pconfig['pppoe_hourly'] = true;
166
							break;
167
					}
168
				}
169
			}
170
			break;
171
	}
172
	
173
}
174

    
175
if ($_POST) {
176

    
177
	unset($input_errors);
178
	$pconfig = $_POST;
179
	
180
	/* okay first of all, cause we are just hiding the PPPoE HTML
181
	 * fields releated to PPPoE resets, we are going to unset $_POST
182
	 * vars, if the reset feature should not be used. Otherwise the
183
	 * data validation procedure below, may trigger a false error
184
	 * message.
185
	 */
186
	if (empty($_POST['pppoe-reset-type'])) {               
187
		unset($_POST['pppoe_resethour']);
188
		unset($_POST['pppoe_resetminute']);
189
		unset($_POST['pppoe_resetdate']);
190
		unset($_POST['pppoe_pr_preset_val']);
191
	}
192

    
193
	/* input validation */		
194
	switch($_POST['type']) {
195
		case "ppp":
196
			$reqdfields = explode(" ", "interfaces phone");
197
			$reqdfieldsn = explode(",", "Link Interface(s),Phone Number");
198
			do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
199
			break;
200
		case "pppoe":
201
			if ($_POST['ondemand']) {
202
				$reqdfields = explode(" ", "interfaces username password ondemand idletimeout");
203
				$reqdfieldsn = explode(",", "Link Interface(s),Username,Password,Dial on demand,Idle timeout value");
204
			} else {
205
				$reqdfields = explode(" ", "interfaces username password");
206
				$reqdfieldsn = explode(",", "Link Interface(s),Username,Password");
207
			}
208
			do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
209
			break;
210
		case "l2tp":
211
		case "pptp":
212
			if ($_POST['ondemand']) {
213
				$reqdfields = explode(" ", "interfaces username password localip subnet gateway ondemand idletimeout");
214
				$reqdfieldsn = explode(",", "Link Interface(s),Username,Password,Local IP address,Subnet,Remote IP address,Dial on demand,Idle timeout value");
215
			} else {
216
				$reqdfields = explode(" ", "interfaces username password localip subnet gateway");
217
				$reqdfieldsn = explode(",", "Link Interface(s),Username,Password,Local IP address,Subnet,Remote IP address");
218
			}
219
			do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
220
			break;
221
		default:
222
			$input_errors[] = "Please choose a Link Type.";
223
			break;
224
	}
225
	if ($_POST['type'] == "ppp" && count($_POST['interfaces']) > 1)
226
		$input_errors[] = "Multilink connections (MLPPP) using the PPP link type is not currently supported. Please select only one Link Interface.";
227
	if (($_POST['provider'] && !is_domain($_POST['provider']))) 
228
		$input_errors[] = "The service name contains invalid characters.";
229
	if (($_POST['idletimeout'] != "") && !is_numericint($_POST['idletimeout'])) 
230
		$input_errors[] = "The idle timeout value must be an integer.";
231
	if ($_POST['pppoe-reset-type'] == "custom" && $_POST['pppoe_resethour'] <> "" && !is_numericint($_POST['pppoe_resethour']) && 
232
		$_POST['pppoe_resethour'] >= 0 && $_POST['pppoe_resethour'] <=23) 
233
		$input_errors[] = gettext("A valid PPPoE reset hour must be specified (0-23).");
234
	if ($_POST['pppoe-reset-type'] == "custom" && $_POST['pppoe_resetminute'] <> "" && !is_numericint($_POST['pppoe_resetminute']) && 
235
		$_POST['pppoe_resetminute'] >= 0 && $_POST['pppoe_resetminute'] <=59) 
236
		$input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59).");
237
	if ($_POST['pppoe-reset-type'] == "custom" && $_POST['pppoe_resetdate'] <> "" && !is_numeric(str_replace("/", "", $_POST['pppoe_resetdate']))) 
238
		$input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy).");
239
	if ($_POST['pppoe-reset-type'] == "custom" && $_POST['pppoe_resetdate'] <> "" && is_numeric(str_replace("/", "", $_POST['pppoe_resetdate']))){
240
		$date_nums = explode("/",$_POST['pppoe_resetdate']);
241
		if ($date_nums[0] < 1 || $date_nums[0] > 12)
242
			$input_errors[] = gettext("A valid PPPoE reset month must be specified (1-12) in the Custom PPPoE Periodic reset fields.");
243
		if ($date_nums[1] < 1 || $date_nums[1] > 31)
244
			$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");
245
		if ($date_nums[2] < date("Y"))
246
			$input_errors[] = gettext("A valid PPPoE reset year must be specified. Don't select a year in the past!");
247
	}
248
	
249
	foreach($_POST['interfaces'] as $iface){
250
		if ($_POST['localip'][$iface] && !is_ipaddr($_POST['localip'][$iface]))
251
			$input_errors[] = "A valid local IP address must be specified for {$iface}.";
252
		if ($_POST['gateway'][$iface] && !is_ipaddr($_POST['gateway'][$iface]) && !is_hostname($_POST['gateway'][$iface])) 
253
			$input_errors[] = "A valid gateway IP address OR hostname must be specified for {$iface}.";
254
		if ($_POST['bandwidth'][$iface] && !is_numericint($_POST['bandwidth'][$iface])) 
255
			$input_errors[] = "The bandwidth value for {$iface} must be an integer.";
256
		if ($_POST['mtu'][$iface] && ($_POST['mtu'][$iface] < 576)) 
257
			$input_errors[] = "The MTU for {$iface} must be greater than 576 bytes.";
258
		if ($_POST['mru'][$iface] && ($_POST['mru'][$iface] < 576)) 
259
			$input_errors[] = "The MRU for {$iface} must be greater than 576 bytes.";
260
	}
261

    
262
/*
263
	foreach ($a_ppps as $ppp) {
264
		if (isset($id) && ($a_ppps[$id]) && ($a_ppps[$id] === $ppp))
265
			continue;
266

    
267
		if ($ppp['serialport'] == $_POST['serialport']) {
268
			$input_errors[] = "Serial port is in use";
269
			break;
270
		}
271
	}
272
*/	
273

    
274
	if (!$input_errors) {
275
		$ppp = array();
276
		$ppp['ptpid'] = $_POST['ptpid'];
277
		$ppp['type'] = $_POST['type'];
278
		$ppp['ports'] = implode(',',$_POST['interfaces']);
279
		$ppp['username'] = $_POST['username'];
280
		$ppp['password'] = base64_encode($_POST['password']);
281
		$ppp['ondemand'] = $_POST['ondemand'] ? true : false;
282
		if (!empty($_POST['idletimeout']))
283
			$ppp['idletimeout'] = $_POST['idletimeout'];
284
		else
285
			unset($ppp['idletimeout']);
286
		$ppp['uptime'] = $_POST['uptime'] ? true : false;
287
		if (!empty($_POST['descr']))
288
			$ppp['descr'] = $_POST['descr'];
289
		else
290
			unset($ppp['descr']);
291

    
292
		// Loop through fields associated with a individual link/port and make an array of the data
293
		$port_fields = array("localip", "gateway", "subnet", "bandwidth", "mtu", "mru", "mrru");
294
		foreach($_POST['interfaces'] as $iface){
295
			foreach($port_fields as $field_label){
296
				if (isset($_POST[$field_label][$iface]))
297
					$port_data[$field_label][] = $_POST[$field_label][$iface];
298
			}
299
		}		
300
				
301
		switch($_POST['type']) {
302
			case "ppp":
303
				if (!empty($_POST['initstr']))
304
					$ppp['initstr'] = base64_encode($_POST['initstr']);
305
				else
306
					unset($ppp['initstr']);
307
				if (!empty($_POST['simpin'])) {
308
					$ppp['simpin'] = $_POST['simpin'];
309
					$ppp['pin-wait'] = $_POST['pin-wait'];
310
				} else {
311
					unset($ppp['simpin']);
312
					unset($ppp['pin-wait']);
313
				}
314
				
315
				if (!empty($_POST['apn'])){
316
					$ppp['apn'] = $_POST['apn'];
317
					if (!empty($_POST['apnum']))
318
						$ppp['apnum'] = $_POST['apnum'];
319
					else
320
						$ppp['apnum'] = "1";
321
				} else {
322
					unset($ppp['apn']);
323
					unset($ppp['apnum']);
324
				}
325
				$ppp['phone'] = $_POST['phone'];
326
				$ppp['localip'] = implode(',',$port_data['localip']);
327
				$ppp['gateway'] = implode(',',$port_data['gateway']);
328
				if (!empty($_POST['connect-timeout']))
329
					$ppp['connect-timeout'] = $_POST['connect-timeout'];
330
				else
331
					unset($ppp['connect-timeout']);
332
				break;
333
			case "pppoe":
334
				if (!empty($_POST['provider']))
335
					$ppp['provider'] = $_POST['provider'];
336
				else
337
					unset($ppp['provider']);
338
				if (!empty($_POST['pppoe-reset-type']))
339
					$ppp['pppoe-reset-type'] = $_POST['pppoe-reset-type'];
340
				else
341
					unset($ppp['pppoe-reset-type']);
342
				
343
				break;
344
			case "pptp":
345
			case "l2tp":
346
				$ppp['dhcp'] = $_POST['pptp_dhcp'] ? true : false;
347
				foreach ($port_data['localip'] as $key => $value){
348
					if (empty($value)){
349
						$port_data['localip'][$key] = "dhcp";
350
						$port_data['subnet'][$key] = "";
351
					}
352
				}
353
				$ppp['localip'] = implode(',',$port_data['localip']);
354
				$ppp['subnet'] = implode(',',$port_data['subnet']);
355
				$ppp['gateway'] = implode(',',$port_data['gateway']);
356
				break;
357
			default:
358
				break;
359
			
360
		}
361
		
362
		$ppp['shortseq'] = $_POST['shortseq'] ? true : false;
363
		$ppp['acfcomp'] = $_POST['acfcomp'] ? true : false;
364
		$ppp['protocomp'] = $_POST['protocomp'] ? true : false;
365
		$ppp['vjcomp'] = $_POST['vjcomp'] ? true : false;
366
		$ppp['tcpmssfix'] = $_POST['tcpmssfix'] ? true : false;
367
		$ppp['bandwidth'] = implode(',', $port_data['bandwidth']);
368
		$ppp['mtu'] = implode(',', $port_data['mtu']);
369
		$ppp['mru'] = implode(',', $port_data['mru']);
370
		
371
		/* handle_pppoe_reset is called here because if user changes Link Type from PPPoE to another type we 
372
		must be able to clear the config data in the <cron> section of config.xml if it exists
373
		*/
374
		handle_pppoe_reset();
375
		
376
        $iflist = get_configured_interface_list();
377
        foreach ($iflist as $if) {
378
        	if ($config['interfaces'][$if]['ptpid'] == $_POST['ptpid']){
379
				$thisif = $if;
380
				break;
381
			}
382
		}
383
		if (isset($id) && $a_ppps[$id])
384
			$a_ppps[$id] = $ppp;
385
		else
386
			$a_ppps[] = $ppp;
387
			
388
		write_config();
389
		configure_cron();
390
		
391
		if (isset($thisif)){
392
			interface_ppps_configure($thisif);
393
		}
394
		header("Location: interfaces_ppps.php");
395
		exit;
396
	}
397
} // end if($_POST)
398

    
399
function handle_pppoe_reset() {
400
	global $_POST, $config, $g;
401

    
402
	if (!is_array($config['cron']['item'])) 
403
		$config['cron']['item'] = array(); 
404
	$itemhash = getMPDCRONSettings($_POST['ptpid']);
405
	$item = $itemhash['ITEM'];
406
	
407
	/* reset cron items if necessary and return*/
408
	if (empty($_POST['pppoe-reset-type'])) {
409
		if (isset($item))
410
			unset($config['cron']['item'][$itemhash['ID']]);
411
		sigkillbypid("{$g['varrun_path']}/cron.pid", "HUP");
412
		return;
413
	}
414

    
415
	if (empty($item)) 
416
		$item = array();
417
	if (isset($_POST['pppoe-reset-type']) && $_POST['pppoe-reset-type'] == "custom") {
418
		$item['minute'] = $_POST['pppoe_resetminute'];
419
		$item['hour'] = $_POST['pppoe_resethour'];
420
		if (isset($_POST['pppoe_resetdate']) && $_POST['pppoe_resetdate'] <> "") {
421
			$date = explode("/", $_POST['pppoe_resetdate']);
422
			$item['mday'] = $date[1];
423
			$item['month'] = $date[0];
424
		} else {
425
			$item['mday'] = "*";
426
			$item['month'] = "*";
427
		}
428
		$item['wday'] = "*";
429
		$item['who'] = "root";
430
		$item['command'] = CRON_PPPOE_CMD_FILE.$_POST['ptpid'];
431
	} else if (isset($_POST['pppoe-reset-type']) && $_POST['pppoe-reset-type'] == "preset") {
432
		switch ($_POST['pppoe_pr_preset_val']) {
433
			case "monthly":
434
				$item['minute'] = "0";
435
				$item['hour'] = "0";
436
				$item['mday'] = "1";
437
				$item['month'] = "*";
438
				$item['wday'] = "*";
439
				$item['who'] = "root";
440
				$item['command'] = CRON_PPPOE_CMD_FILE.$_POST['ptpid'];
441
				break;
442
	        case "weekly":
443
				$item['minute'] = "0";
444
				$item['hour'] = "0";
445
				$item['mday'] = "*";
446
				$item['month'] = "*";
447
				$item['wday'] = "0";
448
				$item['who'] = "root";
449
				$item['command'] = CRON_PPPOE_CMD_FILE.$_POST['ptpid'];
450
				break;
451
			case "daily":
452
				$item['minute'] = "0";
453
				$item['hour'] = "0";
454
				$item['mday'] = "*";
455
				$item['month'] = "*";
456
				$item['wday'] = "*";
457
				$item['who'] = "root";
458
				$item['command'] = CRON_PPPOE_CMD_FILE.$_POST['ptpid'];
459
				break;
460
			case "hourly":
461
				$item['minute'] = "0";
462
				$item['hour'] = "*";
463
				$item['mday'] = "*";
464
				$item['month'] = "*";
465
				$item['wday'] = "*";
466
				$item['who'] = "root";
467
				$item['command'] = CRON_PPPOE_CMD_FILE.$_POST['ptpid'];
468
				break;
469
		} // end switch
470
	}// end if
471
	if (isset($itemhash['ID'])) 
472
		$config['cron']['item'][$itemhash['ID']] = $item;
473
	else 
474
		$config['cron']['item'][] = $item;
475
}
476

    
477
$closehead = false;
478
$pgtitle = array("Interfaces","PPPs","Edit");
479
include("head.inc");
480

    
481
$types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" => "PPTP",  "l2tp" => "L2TP"/*, "tcp" => "TCP", "udp" => "UDP"*/  ); 
482

    
483
?>
484
	<script type="text/javascript" src="/javascript/numericupdown/js/numericupdown.js"></script>
485
	<link href="/javascript/numericupdown/css/numericupdown.css" rel="stylesheet" type="text/css" />
486
	<script type="text/javascript" src="/javascript/datepicker/js/datepicker.js"></script>
487
	<link href="/javascript/datepicker/css/datepicker.css" rel="stylesheet" type="text/css"/>
488
	<script type="text/javascript" >
489
		document.observe("dom:loaded", function() { updateType(<?php echo "'{$pconfig['type']}'";?>); });
490
	</script>
491
</head>
492
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" >
493
<?php include("fbegin.inc"); ?>
494
<?php if ($input_errors) print_input_errors($input_errors); ?>
495
	<form action="interfaces_ppps_edit.php" method="post" name="iform" id="iform">
496
	  <table id="interfacetable" width="100%" border="0" cellpadding="6" cellspacing="0">
497
		<tr>
498
			<td colspan="2" valign="top" class="listtopic"><?= gettext("PPPs configuration"); ?></td>
499
		</tr>
500
		<tr>
501
			<td valign="middle" class="vncell"><strong><?= gettext("Link Type"); ?></strong></td>
502
			<td class="vtable"> 
503
				<select name="type" onChange="updateType(this.value);" class="formselect" id="type">
504
				<?php 
505
					foreach ($types as $key => $opt) { 
506
						echo "<option onClick=\"updateType('{$key}');\"";
507
						if ($key == $pconfig['type']) 
508
							echo " selected";
509
						echo " value=\"{$key}\" >" . htmlspecialchars($opt) . "</option>";
510
					} 
511
				?>
512
				</select>
513
			</td>
514
		</tr>
515
		<tr name="interface" id="interface" >
516
			<td width="22%" valign="top" class="vncellreq"><?= gettext("Link interface(s)"); ?></td>
517
			<td width="78%" class="vtable">
518
				<select valign="top" name="interfaces[]" multiple="true" class="formselect" size="4" onChange="show_hide_linkfields(this.options);">
519
					<option></option>
520
				</select>
521

    
522
				<br/><span class="vexpl"><?= gettext("Select at least two interfaces for Multilink (MLPPP) connections."); ?></span>
523
			</td>
524
		</tr>
525
		<tr style="display:none" name="portlists" id="portlists">
526
			<td id="serialports"><?php
527
				$selected_ports = explode(',',$pconfig['interfaces']);
528
				$serial = glob("/dev/cua*");
529
				$modems = glob("/dev/modem*");
530
				$serialports = array_merge($serial, $modems);
531
				$serport_count = 0;
532
				foreach ($serialports as $port) {
533
					if(preg_match("/\.(lock|init)$/", $port))
534
						continue;
535
					$serport_count++;
536
					echo $port.",".trim($port);
537
					if (in_array($port,$selected_ports))
538
						echo ",1|";
539
					else
540
						echo ",|";
541
				}
542
				echo $serport_count;
543
			?></td>
544
			<td id="ports"><?php
545
				$port_count = 0;
546
				foreach ($portlist as $ifn => $ifinfo){
547
				$port_count++;
548
					echo htmlspecialchars($ifn . " (" . $ifinfo['mac'] . ")") . ",{$ifn}";
549
					if (in_array($ifn,$selected_ports))
550
						echo ",1|";
551
					else
552
						echo ",|";
553
				}
554
				echo $port_count;
555
				if($serport_count > $port_count)
556
					$port_count=$serport_count;
557
			?></td>
558
			<td style="display:none" name="port_count" id="port_count"><?=htmlspecialchars($port_count);?></td>
559
		</tr>
560
		<tr>
561
			<td width="22%" valign="top" class="vncell"><?= gettext("Description"); ?></td>
562
			<td width="78%" class="vtable">
563
				<input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>">
564
				<br/> <span class="vexpl"><?= gettext("You may enter a description here for your reference. Description will appear in the \"Interfaces Assign\" select lists."); ?></span>
565
			</td>
566
		</tr>	
567
		<tr style="display:none" name="select" id="select"></tr>
568
		
569
		<?php $k=0; ?>
570
		
571
		<tr style="display:none" name="ppp_provider" id="ppp_provider">
572
			<td width="22%" valign="top" class="vncell"><?= gettext("Service Provider"); ?></td>
573
			<td width="78%" class="vtable">
574
				<table border="0" cellpadding="0" cellspacing="0">
575
					<tr id="trcountry" style="display:none">
576
						<td><?= gettext("Country"); ?> :&nbsp;&nbsp;</td>
577
						<td>
578
							<select class="formselect" name="country" id="country" onChange="providers_list()">
579
								<option></option>
580
							</select>
581
						</td>
582
					</tr>
583
					<tr id="trprovider" style="display:none">
584
						<td><?= gettext("Provider"); ?> :&nbsp;&nbsp;</td>
585
						<td>
586
							<select class="formselect" name="provider" id="provider" onChange="providerplan_list()">
587
								<option></option>
588
							</select>
589
						</td>
590
					</tr>
591
					<tr id="trproviderplan" style="display:none">
592
						<td><?= gettext("Plan"); ?> :&nbsp;&nbsp;</td>
593
						<td>
594
							<select class="formselect" name="providerplan" id="providerplan" onChange="prefill_provider()">
595
								<option></option>
596
							</select>
597
						</td>
598
					</tr>
599
				</table>
600
				<br/><span class="vexpl"><?= gettext("Select to fill in data for your service provider."); ?></span>
601
			</td>
602
		</tr>
603
		<tr>
604
			<td width="22%" valign="top" class="vncell"><?= gettext("Username"); ?></td>
605
			<td width="78%" class="vtable">
606
			<input name="username" type="text" class="formfld user" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>">
607
			</td>
608
		</tr>
609
		<tr>
610
			<td width="22%" valign="top" class="vncell"><?= gettext("Password"); ?></td>
611
			<td width="78%" class="vtable">
612
			<input name="password" type="password" class="formfld pwd" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>">
613
			</td>
614
		</tr>
615

    
616
		<tr style="display:none" name="phone_num" id="phone_num">
617
			<td width="22%" valign="top" class="vncell"><?= gettext("Phone Number"); ?></td>
618
			<td width="78%" class="vtable">
619
				<input name="phone" type="text" class="formfld unknown" id="phone" size="40" value="<?=htmlspecialchars($pconfig['phone']);?>">
620
				<br/><span class="vexpl"><?= gettext("Note: Typically (*99# for GSM networks and *777 for CDMA networks"); ?></span>
621
			</td>
622
		</tr>
623
		<tr style="display:none" name="apn_" id="apn_">
624
			<td width="22%" valign="top" class="vncell"><?= gettext("Access Point Name (APN)"); ?></td>
625
			<td width="78%" class="vtable">
626
				<input name="apn" type="text" class="formfld unknown" id="apn" size="40" value="<?=htmlspecialchars($pconfig['apn']);?>">
627
			</td>
628
		</tr>
629
		
630
		<tr style="display:none" name="ppp" id="ppp">
631
			<td colspan="2" style="padding:0px;">
632
				<table width="100%" border="0" cellpadding="6" cellspacing="0">		
633
					<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
634
						<td width="22%" valign="top" class="vncell"><?= gettext("APN number (optional)"); ?></td>
635
						<td width="78%" class="vtable">
636
							<input name="apnum" type="text" class="formfld unknown" id="apnum" size="2" value="<?=htmlspecialchars($pconfig['apnum']);?>">
637
							<br/><span class="vexpl"><?= gettext("Note: Defaults to 1 if you set APN above. Ignored if you set no APN above."); ?></span>
638
						</td>
639
					</tr>
640
					<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
641
						<td width="22%" valign="top" class="vncell"><?= gettext("Sim PIN"); ?></td>
642
						<td width="78%" class="vtable">
643
							<input name="simpin" type="text" class="formfld unknown" id="simpin" size="12" value="<?=htmlspecialchars($pconfig['simpin']);?>">
644
						</td>
645
					</tr>
646
			
647
					<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
648
						<td width="22%" valign="top" class="vncell"><?= gettext("Sim PIN wait"); ?></td>
649
						<td width="78%" class="vtable">
650
							<input name="pin-wait" type="text" class="formfld unknown" id="pin-wait" size="2" value="<?=htmlspecialchars($pconfig['pin-wait']);?>">
651
							<br/><span class="vexpl"><?= gettext("Note: Time to wait for SIM to discover network after PIN is sent to SIM (seconds)."); ?></span>
652
						</td>
653
					</tr>
654
					<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
655
						<td width="22%" valign="top" class="vncell"><?= gettext("Init String"); ?></td>
656
						<td width="78%" class="vtable">
657
							<input type="text" size="40" class="formfld unknown" id="initstr" name="initstr" value="<?=htmlspecialchars($pconfig['initstr']);?>">
658
							<br/><span class="vexpl"><?= gettext("Note: Enter the modem initialization string here. Do NOT include the \"AT\" 
659
							string at the beginning of the command. Many modern USB 3G modems don't need an initialization string."); ?></span>
660
						</td>
661
					</tr>
662
					<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
663
						<td width="22%" valign="top" class="vncell"><?= gettext("Connection Timeout"); ?></td>
664
						<td width="78%" class="vtable">
665
							<input name="connect-timeout" type="text" class="formfld unknown" id="connect-timeout" size="2" value="<?=htmlspecialchars($pconfig['connect-timeout']);?>">
666
							<br/><span class="vexpl"><?= gettext("Note: Enter timeout in seconds for connection to be established (sec.) Default is 45 sec."); ?></span>
667
						</td>
668
					</tr>
669
					<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
670
						<td valign="top" class="vncell"><?= gettext("Uptime Logging"); ?></td>
671
						<td class="vtable">
672
							<input type="checkbox" value="on" id="uptime" name="uptime" <?php if (isset($pconfig['uptime'])) echo "checked"; ?>> <?= gettext("Enable persistent logging of connection uptime."); ?> 
673
							<br/> <span class="vexpl"><?= gettext("This option causes cumulative uptime to be recorded and displayed on the Status Interfaces page."); ?></span>
674
						</td>
675
					</tr>
676
				</table>
677
			</td>
678
		</tr>
679
		<tr style="display:none" name="pppoe" id="pppoe">
680
			<td colspan="2" style="padding:0px;">
681
				<table width="100%" border="0" cellpadding="6" cellspacing="0">
682
					<tr>
683
						<td width="22%" valign="top" class="vncell"><?= gettext("Service name"); ?></td>
684
						<td width="78%" class="vtable"><input name="provider" type="text" class="formfld unknown" id="provider" size="20" value="<?=htmlspecialchars($pconfig['provider']);?>">
685
							<br/> <span class="vexpl"><?= gettext("Hint: this field can usually be left empty"); ?></span>
686
						</td>
687
					</tr>
688
					<tr>
689
						<td width="22%" valign="top" class="vncell"><?=gettext("Periodic reset");?></td>
690
						<td width="78%" class="vtable">
691
							<table id="presetwrap" cellspacing="0" cellpadding="0" width="100%">
692
								<tr>
693
									<td align="left" valign="top">
694
										<p style="margin: 4px; padding: 4px 0 4px 0; width: 94%;">
695
										<select valign="top" id="reset_type" name="pppoe-reset-type" class="formselect" onChange="show_reset_settings(this.value);">
696
											<option value = ""><?= gettext("Disabled"); ?></option>
697
											<option value="custom" <?php if ($pconfig['pppoe-reset-type'] == "custom") echo "selected"; ?>><?= gettext("Custom"); ?></option>
698
											<option value="preset" <?php if ($pconfig['pppoe-reset-type'] == "preset") echo "selected"; ?>><?= gettext("Pre-Set"); ?></option>
699
										</select> <?= gettext("Select a reset timing type"); ?>
700
										</p>
701
										<?php if ($pconfig['pppoe_pr_custom']): ?>
702
											<p style="margin: 2px; padding: 4px; width: 94%;" id="pppoecustomwrap">
703
										<?php else: ?>
704
											<p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoecustomwrap">
705
										<?php endif; ?>
706
										<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" /> 
707
										<?= gettext("hour (0-23)"); ?><br />
708
										<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" /> 
709
										<?= gettext("minute (0-59)"); ?><br />
710
										<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']);?>" /> 
711
										<?= gettext("reset at a specific date (mm/dd/yyyy)"); ?>
712
										<br />&nbsp;<br />
713
										<span class="red"><strong>Note: </strong></span>
714
										<?= 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."); ?>
715
										</p>
716
										<?php if ($pconfig['pppoe_pr_preset']): ?>
717
											<p style="margin: 2px; padding: 4px; width: 94%;" id="pppoepresetwrap">
718
										<?php else: ?>
719
											<p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoepresetwrap">
720
										<?php endif; ?>
721
										<input name="pppoe_pr_preset_val" type="radio" id="pppoe_monthly" value="monthly" <?php if ($pconfig['pppoe_monthly']) echo "checked=\"checked\""; ?> /> 
722
										<?= gettext("reset at each month ('0 0 1 * *')"); ?>
723
										<br />
724
										<input name="pppoe_pr_preset_val" type="radio" id="pppoe_weekly" value="weekly" <?php if ($pconfig['pppoe_weekly']) echo "checked=\"checked\""; ?> /> 
725
										<?= gettext("reset at each week ('0 0 * * 0')"); ?>
726
										<br />
727
										<input name="pppoe_pr_preset_val" type="radio" id="pppoe_daily" value="daily" <?php if ($pconfig['pppoe_daily']) echo "checked=\"checked\""; ?> /> 
728
										<?= gettext("reset at each day ('0 0 * * *')"); ?>
729
										<br />
730
										<input name="pppoe_pr_preset_val" type="radio" id="pppoe_hourly" value="hourly" <?php if ($pconfig['pppoe_hourly']) echo "checked=\"checked\""; ?> /> 
731
										<?= gettext("reset at each hour ('0 * * * *')"); ?>
732
										</p>
733
									</td>
734
								</tr>
735
							</table>
736
						</td>
737
					</tr>
738
				</table>
739
			</td>
740
		</tr>
741

    
742
		<?php for($j=0; $j < $port_count; $j++) : ?>
743
		
744
		<tr style="display:none" id="gw_fields<?=$j;?>">
745
			<td width="22%" id="localiplabel<?=$j;?>" valign="top" class="vncell"><?= gettext("Local IP"); ?></td>
746
			<td width="78%" class="vtable"> 
747
				<input name="localip[]" type="text" class="formfld unknown" id="localip<?=$j;?>" size="20"  value="<?=htmlspecialchars($pconfig['localip'][$j]);?>">
748
				/
749
				<select name="subnet[]" class="formselect" id="subnet<?=$j;?>" disabled="true">
750
				<?php for ($i = 31; $i > 0; $i--): ?>
751
					<option value="<?=$i;?>"<?php if ($i == $pconfig['subnet'][$j]) echo " selected"; ?>><?=$i;?></option>
752
				<?php endfor; ?>
753
				</select> <?= gettext("IP Address (Leave empty to enable DHCP)"); ?>
754
				
755
			</td>
756
		</tr>
757
		<tr style="display:none" id="ip_fields<?=$j;?>">
758
			<td width="22%" id="gatewaylabel<?=$j;?>" valign="top" class="vncell"></td>
759
			<td width="78%" class="vtable">
760
				<input name="gateway[]" type="text" class="formfld unknown" id="gateway<?=$j;?>" size="20" value="<?=htmlspecialchars($pconfig['gateway'][$j]);?>"><?= gettext("IP Address OR Hostname"); ?>
761
			</td>
762
		</tr><?php endfor; ?>
763

    
764
		<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
765
			<td colspan="2" valign="top" height="16"></td>
766
		</tr>
767
		<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
768
			<td colspan="2" valign="top" class="listtopic"><?= gettext("Advanced Options"); ?></td>
769
		</tr>
770
		<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
771
		<td valign="top" class="vncell"><?= gettext("Dial On Demand"); ?></td>
772
			<td class="vtable">
773
				<input type="checkbox" value="on" id="ondemand" name="ondemand" <?php if (isset($pconfig['ondemand'])) echo "checked"; ?>> <?= gettext("Enable Dial-on-Demand mode"); ?> 
774
				<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. 
775
				The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected."); ?> </span>
776
			</td>
777
		</tr>
778
		<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
779
			<td valign="top" class="vncell"><?= gettext("Idle Timeout"); ?></td>
780
			<td class="vtable">
781
				<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."); ?>
782
				<br/> <span class="vexpl"><?= gettext("If no incoming or outgoing packets are transmitted for the entered number of seconds the connection is brought down.
783
				<br/>When the idle timeout occurs, if the dial-on-demand option is enabled, mpd goes back into dial-on-demand mode. Otherwise, the interface is brought down and all associated routes removed."); ?></span>
784
			</td>
785
		</tr>
786
		<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
787
			<td width="22%" valign="top" class="vncell"><?= gettext("Compression"); ?></td>
788
			<td width="78%" class="vtable">
789
				<input type="checkbox" value="on" id="vjcomp" name="vjcomp" <?php if (isset($pconfig['vjcomp'])) echo "checked"; ?>>&nbsp;<?= gettext("Disable vjcomp(compression) (enabled by default)."); ?>
790
				<br/> <span class="vexpl">This option enables Van Jacobson TCP header compression, which saves several bytes per TCP data packet. 
791
				You almost always want this option. This compression ineffective for TCP connections with enabled modern extensions like time 
792
				stamping or SACK, which modify TCP options between sequential packets.</span>
793
			</td>
794
		</tr>
795
		<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
796
			<td width="22%" valign="top" class="vncell"><?= gettext("TCPmssFix"); ?></td>
797
			<td width="78%" class="vtable">
798
				<input type="checkbox" value="on" id="tcpmssfix" name="tcpmssfix" <?php if (isset($pconfig['tcpmssfix'])) echo "checked"; ?>>&nbsp;<?= gettext("Disable tcpmssfix (enabled by default)."); ?>
799
				<br/> <span class="vexpl">This option causes mpd to adjust incoming and outgoing TCP SYN segments so that the requested maximum segment size is not greater than the amount 
800
				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,
801
				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,
802
				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 
803
				gets to discover that it must reduce the fragment size or drop the IP Don't Fragment option from its outgoing data.</span>
804
			</td>
805
		</tr>
806
		<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
807
			<td width="22%" valign="top" class="vncell">ShortSeq</td>
808
			<td width="78%" class="vtable">
809
				<input type="checkbox" value="on" id="shortseq" name="shortseq" <?php if (isset($pconfig['shortseq'])) echo "checked"; ?>>&nbsp;<?= gettext("Disable shortseq (enabled by default)."); ?>
810
				<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. 
811
				It is not necessary to disable this for connections that are not multi-link."); ?></span>
812
			</td>
813
		</tr>
814
		<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
815
			<td width="22%" valign="top" class="vncell">ACFComp</td>
816
			<td width="78%" class="vtable">
817
				<input type="checkbox" value="on" id="acfcomp" name="acfcomp" <?php if (isset($pconfig['acfcomp'])) echo "checked"; ?>>&nbsp;<?= gettext("Disable acfcomp(compression) (enabled by default)."); ?>
818
				<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>
819
			</td>
820
		</tr>
821
		<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
822
			<td width="22%" valign="top" class="vncell">ProtoComp</td>
823
			<td width="78%" class="vtable">
824
				<input type="checkbox" value="on" id="protocomp" name="protocomp" <?php if (isset($pconfig['protocomp'])) echo "checked"; ?>>&nbsp;<?= gettext("Disable protocomp(compression) (enabled by default)."); ?>
825
				<br/> <span class="vexpl"><?= gettext("Protocol field compression. This option saves one byte per frame for most frames."); ?></span>
826
			</td>
827
		</tr>
828
		<tr id="advanced_" name="advanced_">
829
			<td>&nbsp;</td>
830
			<td>
831
			<p><input type="button" onClick="show_advanced(1)" value="Show advanced options"></p>
832
			</td>
833
			<td style="display:none" id="adv_rows" name="adv_rows"><?=$k;?></td>
834
			<td style="display:none" id="adv_show" name="adv_show">0</td>
835
		</tr>
836
		<tr>
837
		<?php for($i=0; $i < $port_count; $i++) : ?>
838
		<tr style="display:none" id="link<?=$i;?>">
839
			<td width="22%" valign="top" id="linklabel<?=$i;?>" class="vncell"> Link Parameters</td>
840
			<td class="vtable">
841
				<table name="link_parameters" border="0" cellpadding="6" cellspacing="0">
842
					<tr>
843
						<td width="22%" id="bwlabel<?=$i;?>" valign="top"class="vncell"> Bandwidth</td>
844
						<td width="78%" class="vtable">
845
						<br/><input name="bandwidth[]" id="bandwidth<?=$i;?>" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['bandwidth'][$i]);?>">
846
						<br/> <span class="vexpl">Set Bandwidth for each link ONLY for MLPPP connections and ONLY when links have different bandwidths.</span>
847
					  </td>
848
					</tr>
849
					<tr>
850
					  <td width="22%" id="mtulabel<?=$i;?>" valign="top" class="vncell"> MTU</td>
851
					  <td width="78%" class="vtable">
852
						<input name="mtu[]" id="mtu<?=$i;?>" type="text" class="formfld unknown" size="6" value="<?=htmlspecialchars($pconfig['mtu'][$i]);?>">
853
						<br> <span class="vexpl">Set MTU for each link if links have different bandwidths, otherwise, mtu will default to 1492.</span>
854
					  </td>
855
					</tr>
856
					<tr>
857
					  <td width="22%" id="mrulabel<?=$i;?>" valign="top" class="vncell"> MRU</td>
858
					  <td width="78%" class="vtable">
859
						<input name="mru[]" id="mru<?=$i;?>" type="text" class="formfld unknown" size="6" value="<?=htmlspecialchars($pconfig['mru'][$i]);?>">
860
						<br> <span class="vexpl">Set MRU for each link if links have different bandwidths, otherwise, mru will default to 1492.</span>
861
					  </td>
862
					</tr>
863
				</table
864
			</td>
865
		</tr><?php endfor; ?>
866
		<tr>
867
			<td width="22%" valign="top">&nbsp;</td>
868
			<td width="78%">
869
				<input name="Submit" type="submit" class="formbtn" value="Save">
870
				<input type="button" value="Cancel" onclick="history.back()">
871
				<?php
872
					if (isset($a_ppps[$id]['ptpid']))
873
						$ptpid = $a_ppps[$id]['ptpid'];
874
					else
875
						$ptpid = uniqid('', true);
876
				?>
877
				<input name="ptpid" type="hidden" value="<?=$ptpid;?>">
878
				<?php if (isset($id) && $a_ppps[$id]): ?>
879
					<input name="id" type="hidden" value="<?=$id;?>">
880
				<?php endif; ?>
881
			</td>
882
		</tr>
883
	</table>
884
</form>
885
<?php include("fend.inc"); ?>
886
</body>
887
</html>
(94-94/220)