Project

General

Profile

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