Project

General

Profile

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