Project

General

Profile

« Previous | Next » 

Revision 42809b4a

Added by Marcus Brown about 15 years ago

Use "PPPs" as the new Tab name in Interfaces -> Assign. Rename files and update affected files.

Also, add upgrade_config function 062_to_063.

View differences:

etc/inc/globals.inc
88 88
	"disablehelpmenu" => false,
89 89
	"disablehelpicon" => false,
90 90
	"debug" => false,
91
	"latest_config" => "6.2",
91
	"latest_config" => "6.3",
92 92
	"nopkg_platforms" => array("cdrom"),
93 93
	"minimum_ram_warning" => "105",
94 94
	"minimum_ram_warning_text" => "128 MB",
etc/inc/interfaces.inc
884 884
	$wancfg = &$config['interfaces'][$interface];
885 885
	if (is_array($config['ppps']['ppp']) && count($config['ppps']['ppp'])) {
886 886
		foreach ($config['ppps']['ppp'] as $pppid => $ppp) {
887
			//$ppp['port'] = $ppp['ports'];
888
			if ($interface == $ppp['ifname'])
887
			if ($wancfg['ptpid'] == $ppp['ptpid'])
889 888
				break;
890 889
		}
891 890
	}
892
	if (!$ppp || !isset($ppp['ifname']))
893
		return;	
891
	if (!$ppp || $wancfg['ptpid'] != $ppp['ptpid'] || stristr($ppp['ports'], ",")){
892
		log_error("PPP configuration error.");
893
		return;
894
	}
894 895
/*
895 896
	if ($interface == "wan")
896 897
		$pppid = "0";
......
996 997
EOD;
997 998

  
998 999
	$mpdconf .= <<<EOD
999
	set modem device {$ppp['port']}
1000
	set modem device {$ppp['ports']}
1000 1001
	set modem script DialPeer
1001 1002
	set modem idle-script Ringback
1002 1003
	set modem watch -cd
......
1039 1040
	fclose($fd);
1040 1041

  
1041 1042
	// Launch specified ppp instance
1042
	if (file_exists("{$ppp['port']}")) {
1043
	if (file_exists("{$ppp['ports']}")) {
1043 1044
		/* fire up mpd */
1044 1045
		mwexec("/usr/local/sbin/mpd5 -b -k -d {$g['varetc_path']} -f mpd_{$interface}.conf -p {$g['varrun_path']}/ppp_{$interface}.pid -s {$interface} pppclient");
1045 1046
	} else
1046
		log_error("Device {$ppp['port']} has disappeared.");
1047
		log_error("Device {$ppp['ports']} has disappeared.");
1047 1048
}
1048 1049

  
1049 1050
function interfaces_carp_setup() {
......
2640 2641
							$counter++;
2641 2642
					}
2642 2643
					break;
2643
				case "pppoe": 
2644
/*				case "pppoe": 
2644 2645
					if ($if == "wan")
2645 2646
						$wanif = "pppoe0";
2646 2647
					else
......
2658 2659
					else
2659 2660
						$wanif = "ppp" . substr($if, 3);
2660 2661
					break;
2662
*/
2661 2663
				default:
2662 2664
					$wanif = $cfg['if'];
2663 2665
					break;
etc/inc/pfsense-utils.inc
1313 1313
					break;
1314 1314
			}
1315 1315
		}
1316
		$dev = $ppp['port'];
1316
		$dev = $ppp['ports'];
1317 1317
		if (empty($dev))
1318 1318
			break;
1319 1319
		if (file_exists($dev)) {
etc/inc/upgrade_config.inc
1901 1901
	}
1902 1902
}
1903 1903

  
1904
function upgrade_062_to_063() {
1905
	global $config;
1906
	if (is_array($config['ppps']['ppp']) && count($config['ppps']['ppp'])) {
1907
		foreach ($config['ppps']['ppp'] as $pppid => $ppp) {
1908
			if (isset($ppp['port'])){
1909
				$config['ppps']['ppp'][$pppid]['ports'] = $ppp['port'];
1910
				unset($config['ppps']['ppp'][$pppid]['port']);
1911
			}
1912
			if (!isset($ppp['type'])){
1913
				$config['ppps']['ppp'][$pppid]['type'] = "ppp";
1914
			}
1915
			if (!isset($ppp['ptpid'])){
1916
				$config['ppps']['ppp'][$pppid]['ptpid'] = uniqid('', true);
1917
			}
1918
		}
1919
	}
1920
}
1904 1921
?>
usr/local/www/interfaces_assign.php
131 131
		$portname = $ppp['type'].$pppid;
132 132
		$portlist[$portname] = $ppp;
133 133
		$portlist[$portname]['isppp'] = true;
134
		$portlist[$portname]['pppid'] = $pppid;
135
		$portlist[$portname]['descr'] = strtoupper($ppp['type']) . $pppid ." - ".$ppp['descr'];
134
		if (isset($ppp['descr']))
135
			$portlist[$portname]['descr'] = strtoupper($ppp['type']) . " - ". $ppp['descr'];
136
		else
137
			$portlist[$portname]['descr'] = strtoupper($ppp['type']) . " - ". $ppp['ports'];
136 138
	}
137 139
}
138 140

  
......
188 190

  
189 191

  
190 192
	if (!$input_errors) {
191
		/* The 'ifname' must be unset for all PPPs before continuing or we can get legacy data
192
		left in the ppps config sections */
193
		if (is_array($config['ppps']['ppp']) && count($config['ppps']['ppp'])){
194
			foreach ($config['ppps']['ppp'] as $pppid => $ppp) {
195
				unset($config['ppps']['ppp'][$pppid]['ifname']);
196
			}
197
		}
198 193
		/* No errors detected, so update the config */
199 194
		foreach ($_POST as $ifname => $ifport) {
200 195
		
......
213 208
					/*For PPP interfaces, write link type to IP address field to signal that IP 
214 209
					addr is dynamic and comes from PPP, PPPoE, or PPTP */
215 210
					if (isset($portlist[$ifport]['isppp'])){
211
						if ($ifname == "wan")
212
							$config['interfaces'][$ifname]['if'] = $portlist[$ifport]['type'] ."0";
213
						else
214
							$config['interfaces'][$ifname]['if'] = $portlist[$ifport]['type'] . substr($ifname,3);
215

  
216 216
						$config['interfaces'][$ifname]['ipaddr'] = $portlist[$ifport]['type'];
217
						foreach ($config['ppps']['ppp'] as $pppid => $ppp) {
218
							if ($portlist[$ifport]['pppid'] == $pppid)
219
								$config['ppps']['ppp'][$pppid]['ifname'] = $ifname;
220
						}
221
					}
217
						$config['interfaces'][$ifname]['ptpid'] = $portlist[$ifport]['ptpid'];
218
					} else
219
						unset($config['interfaces'][$ifname]['ptpid']);
220
					
222 221
					/* check for wireless interfaces, set or clear ['wireless'] */
223 222
					if (preg_match($g['wireless_regex'], $ifport)) {
224 223
						if (!is_array($config['interfaces'][$ifname]['wireless']))
......
294 293
					unset($config['nat']['rule'][$x]['interface']);
295 294
			}
296 295
        }
297
        /* Clean up association with deleted interface in PPPs config section */
298
        if (is_array($config['ppps']['ppp']) && count($config['ppps']['ppp'])){
299
        	foreach ($config['ppps']['ppp'] as $pppid => $ppp) {
300
        		if ($ppp['ifname'] == $id)
301
        			unset($config['ppps']['ppp'][$pppid]['ifname']);
302
        	}
303
        }
304 296

  
305 297
		write_config();
306 298
	
......
396 388
	$tab_array[2] = array("Wireless", false, "interfaces_wireless.php");
397 389
	$tab_array[3] = array("VLANs", false, "interfaces_vlan.php");
398 390
	$tab_array[4] = array("QinQs", false, "interfaces_qinq.php");
399
	$tab_array[5] = array("PPP", false, "interfaces_ppp.php");
400
	$tab_array[6] = array("MLPPP", false, "interfaces_mlppp.php");
391
	$tab_array[5] = array("PPPs", false, "interfaces_ppps.php");
401 392
	$tab_array[7] = array("GRE", false, "interfaces_gre.php");
402 393
	$tab_array[8] = array("GIF", false, "interfaces_gif.php");
403 394
	$tab_array[9] = array("Bridges", false, "interfaces_bridge.php");
......
427 418
		  <?php foreach ($portlist as $portname => $portinfo): ?>
428 419
			<option value="<?=$portname;?>" <?php 
429 420
				if (isset($portinfo['isppp'])){
430
					if ($portinfo['ifname'] == $ifname) echo "selected";
421
					if ($portinfo['ptpid'] == $iface['ptpid']) echo "selected";
431 422
				}
432 423
				else
433 424
					if ($portname == $iface['if']) echo "selected";
usr/local/www/interfaces_bridge.php
91 91
	$tab_array[2] = array("Wireless", false, "interfaces_wireless.php");
92 92
	$tab_array[3] = array("VLANs", false, "interfaces_vlan.php");
93 93
	$tab_array[4] = array("QinQs", false, "interfaces_qinq.php");
94
	$tab_array[5] = array("PPP", false, "interfaces_ppp.php");
95
	$tab_array[6] = array("MLPPP", false, "interfaces_mlppp.php");
94
	$tab_array[5] = array("PPPs", false, "interfaces_ppps.php");
96 95
	$tab_array[7] = array("GRE", false, "interfaces_gre.php");
97 96
	$tab_array[8] = array("GIF", false, "interfaces_gif.php");
98 97
	$tab_array[9] = array("Bridges", true, "interfaces_bridge.php");
usr/local/www/interfaces_gif.php
90 90
	$tab_array[2] = array("Wireless", false, "interfaces_wireless.php");
91 91
	$tab_array[3] = array("VLANs", false, "interfaces_vlan.php");
92 92
	$tab_array[4] = array("QinQs", false, "interfaces_qinq.php");
93
	$tab_array[5] = array("PPP", false, "interfaces_ppp.php");
94
	$tab_array[6] = array("MLPPP", false, "interfaces_mlppp.php");
93
	$tab_array[5] = array("PPPs", false, "interfaces_ppps.php");
95 94
	$tab_array[7] = array("GRE", false, "interfaces_gre.php");
96 95
	$tab_array[8] = array("GIF", true, "interfaces_gif.php");
97 96
	$tab_array[9] = array("Bridges", false, "interfaces_bridge.php");
usr/local/www/interfaces_gre.php
90 90
	$tab_array[2] = array("Wireless", false, "interfaces_wireless.php");
91 91
	$tab_array[3] = array("VLANs", false, "interfaces_vlan.php");
92 92
	$tab_array[4] = array("QinQs", false, "interfaces_qinq.php");
93
	$tab_array[5] = array("PPP", false, "interfaces_ppp.php");
94
	$tab_array[6] = array("MLPPP", false, "interfaces_mlppp.php");
93
	$tab_array[5] = array("PPPs", false, "interfaces_ppps.php");
95 94
	$tab_array[7] = array("GRE", true, "interfaces_gre.php");
96 95
	$tab_array[8] = array("GIF", false, "interfaces_gif.php");
97 96
	$tab_array[9] = array("Bridges", false, "interfaces_bridge.php");
usr/local/www/interfaces_groups.php
76 76
	$tab_array[2] = array("Wireless", false, "interfaces_wireless.php");
77 77
	$tab_array[3] = array("VLANs", false, "interfaces_vlan.php");
78 78
	$tab_array[4] = array("QinQs", false, "interfaces_qinq.php");
79
	$tab_array[5] = array("PPP", false, "interfaces_ppp.php");
80
	$tab_array[6] = array("MLPPP", false, "interfaces_mlppp.php");
79
	$tab_array[5] = array("PPPs", false, "interfaces_ppps.php");
81 80
	$tab_array[7] = array("GRE", false, "interfaces_gre.php");
82 81
	$tab_array[8] = array("GIF", false, "interfaces_gif.php");
83 82
	$tab_array[9] = array("Bridges", false, "interfaces_bridge.php");
usr/local/www/interfaces_lagg.php
96 96
	$tab_array[2] = array("Wireless", false, "interfaces_wireless.php");
97 97
	$tab_array[3] = array("VLANs", false, "interfaces_vlan.php");
98 98
	$tab_array[4] = array("QinQs", false, "interfaces_qinq.php");
99
	$tab_array[5] = array("PPP", false, "interfaces_ppp.php");
100
	$tab_array[6] = array("MLPPP", false, "interfaces_mlppp.php");
99
	$tab_array[5] = array("PPPs", false, "interfaces_ppps.php");
101 100
	$tab_array[7] = array("GRE", false, "interfaces_gre.php");
102 101
	$tab_array[8] = array("GIF", false, "interfaces_gif.php");
103 102
	$tab_array[9] = array("Bridges", false, "interfaces_bridge.php");
usr/local/www/interfaces_mlppp.php
1
<?php
2
/* $Id$ */
3
/*
4
	interfaces_mlppp.php
5
	part of m0n0wall (http://m0n0.ch/wall)
6

  
7
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
8
	All rights reserved.
9

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

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

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

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

  
36
##|+PRIV
37
##|*IDENT=page-interfaces-mlppp
38
##|*NAME=Interfaces: mlppp page
39
##|*DESCR=Allow access to the 'Interfaces: mlppp' page.
40
##|*MATCH=interfaces_mlppp.php*
41
##|-PRIV
42

  
43
require("guiconfig.inc");
44

  
45
if (!is_array($config['ppps']['ppp']))
46
	$config['ppps']['ppp'] = array();
47

  
48
$a_ppps = &$config['ppps']['ppp'] ;
49

  
50
function ppp_inuse($num) {
51
	global $a_ppps;
52
	
53
	if (isset($a_ppps[$num]['ifname']))
54
		return true;
55
	else
56
		return false;
57
}
58

  
59
if ($_GET['act'] == "del") {
60
	/* check if still in use */
61
	if (ppp_inuse($_GET['id'])) {
62
		$input_errors[] = "This MLPPP interface cannot be deleted because it is still being used as an interface.";
63
	} else {
64
		unset($a_ppps[$_GET['id']]);
65
		write_config();
66
		header("Location: interfaces_mlppp.php");
67
		exit;
68
	}
69
}
70

  
71
$pgtitle = "Interfaces: MLPPP";
72
include("head.inc");
73

  
74
?>
75

  
76
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
77
<?php include("fbegin.inc"); ?>
78
<?php if ($input_errors) print_input_errors($input_errors); ?>
79
<table width="100%" border="0" cellpadding="0" cellspacing="0">
80
  <tr><td>
81
<?php
82
	$tab_array = array();
83
	$tab_array[0] = array("Interface assignments", false, "interfaces_assign.php");
84
	$tab_array[1] = array("Interface Groups", false, "interfaces_groups.php");
85
	$tab_array[2] = array("Wireless", false, "interfaces_wireless.php");
86
	$tab_array[3] = array("VLANs", false, "interfaces_vlan.php");
87
	$tab_array[4] = array("QinQs", false, "interfaces_qinq.php");
88
	$tab_array[5] = array("PPP", false, "interfaces_ppp.php");
89
	$tab_array[6] = array("MLPPP", true, "interfaces_mlppp.php");
90
	$tab_array[7] = array("GRE", false, "interfaces_gre.php");
91
	$tab_array[8] = array("GIF", false, "interfaces_gif.php");
92
	$tab_array[9] = array("Bridges", false, "interfaces_bridge.php");
93
	$tab_array[10] = array("LAGG", false, "interfaces_lagg.php");
94
	display_top_tabs($tab_array);
95
?>
96
  </td></tr>
97
  <tr>
98
    <td>
99
	<div id="mainarea">
100
	<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
101
                <tr>
102
                	<td width="20%" class="listhdrr">Type</td>
103
                  <td width="20%" class="listhdrr">Interface(s)/Port(s)</td>
104
                  <td width="40%" class="listhdr">Description</td>
105
                  <td width="10%" class="list"></td>
106
				</tr>
107
			  <?php $i = 0; foreach ($a_ppps as $id => $ppp): ?>
108
                <tr  ondblclick="document.location='interfaces_mlppp_edit.php?id=<?=$i;?>'">
109
                	<td class="listr">
110
					<?=htmlspecialchars($ppp['type'].$id);?>
111
                  </td>
112
                  <td class="listr">
113
					<?=htmlspecialchars($ppp['ports']);?>
114
                  </td>
115
                  <td class="listbg">
116
                    <?=htmlspecialchars($ppp['descr']);?>&nbsp;
117
                  </td>
118
                  <td valign="middle" nowrap class="list"> <a href="interfaces_mlppp_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a>
119
                     &nbsp;<a href="interfaces_mlppp.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this PPP interface?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
120
				</tr>
121
			  <?php $i++; endforeach; ?>
122
                <tr>
123
                  <td class="list" colspan="3">&nbsp;</td>
124
                  <td class="list"> <a href="interfaces_mlppp_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
125
				</tr>
126
              </table>
127
	      </div>
128
	</td>
129
	</tr>
130
</table>
131
<?php include("fend.inc"); ?>
132
</body>
133
</html>
usr/local/www/interfaces_mlppp_edit.php
1
<?php
2
/* $Id$ */
3
/*
4
	interfaces_mlppp_edit.php
5
	part of m0n0wall (http://m0n0.ch/wall)
6

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

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

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

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

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

  
37
##|+PRIV
38
##|*IDENT=page-interfaces-mlppp-edit
39
##|*NAME=Interfaces: MLPPP: Edit page
40
##|*DESCR=Allow access to the 'Interfaces: MLPPP: Edit' page.
41
##|*MATCH=interfaces_mlppp_edit.php*
42
##|-PRIV
43

  
44
require("guiconfig.inc");
45

  
46
define("CRON_PPPOE_CMD_FILE", "/conf/pppoe{$if}restart");
47
define("CRON_MONTHLY_PATTERN", "0 0 1 * *");
48
define("CRON_WEEKLY_PATTERN", "0 0 * * 0");
49
define("CRON_DAILY_PATTERN", "0 0 * * *");
50
define("CRON_HOURLY_PATTERN", "0 * * * *");
51

  
52
if (!is_array($config['ppps']['ppp']))
53
	$config['ppps']['ppp'] = array();
54

  
55
$a_ppps = &$config['ppps']['ppp'];
56

  
57
$portlist = get_interface_list();
58

  
59
function getMPDCRONSettings() {
60
	global $config;
61
	if (is_array($config['cron']['item'])) {
62
		for ($i = 0; $i < count($config['cron']['item']); $i++) {
63
			$item = $config['cron']['item'][$i];
64
			if (strpos($item['command'], CRON_PPPOE_CMD_FILE) !== false) {
65
				return array("ID" => $i, "ITEM" => $item);
66
			}
67
		}
68
	}
69
	return NULL;
70
}
71

  
72
function getMPDResetTimeFromConfig() {
73
	$itemhash = getMPDCRONSettings();
74
	$cronitem = $itemhash['ITEM'];
75
	if (isset($cronitem)) {
76
		return "{$cronitem['minute']} {$cronitem['hour']} {$cronitem['mday']} {$cronitem['month']} {$cronitem['wday']}";
77
	} else {
78
		return NULL;
79
	}
80
}
81

  
82
function remove_bad_chars($string) {
83
	return preg_replace('/[^a-z|_|0-9]/i','',$string);
84
}
85

  
86
$id = $_GET['id'];
87
if (isset($_POST['id']))
88
	$id = $_POST['id'];
89

  
90

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

  
174
if ($_POST) {
175

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

  
196
	/* input validation */		
197
	switch($_POST['type']) {
198
		case "ppp":
199
			$reqdfields = explode(" ", "interfaces phone");
200
			$reqdfieldsn = explode(",", "Link Interface(s),Phone Number");
201
			do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
202
			break;
203
		case "pppoe":
204
			if ($_POST['ondemand']) {
205
				$reqdfields = explode(" ", "interfaces username password ondemand idletimeout");
206
				$reqdfieldsn = explode(",", "Link Interface(s),Username,Password,Dial on demand,Idle timeout value");
207
			} else {
208
				$reqdfields = explode(" ", "interfaces username password");
209
				$reqdfieldsn = explode(",", "Link Interface(s),Username,Password");
210
			}
211
			do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
212
			break;
213
		case "pptp":
214
			if ($_POST['ondemand']) {
215
				$reqdfields = explode(" ", "interfaces username password localip subnet gateway ondemand idletimeout");
216
				$reqdfieldsn = explode(",", "Link Interface(s),Username,Password,Local IP address,Subnet,Remote IP address,Dial on demand,Idle timeout value");
217
			} else {
218
				$reqdfields = explode(" ", "interfaces username password localip subnet gateway");
219
				$reqdfieldsn = explode(",", "Link Interface(s),Username,Password,Local IP address,Subnet,Remote IP address");
220
			}
221
			do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
222
			break;
223
		default:
224
			$input_errors[] = "Please choose a Link Type.";
225
			break;
226
	}
227
	if (($_POST['provider'] && !is_domain($_POST['provider']))) 
228
		$input_errors[] = "The service name contains invalid characters.";
229
	if (($_POST['idletimeout'] != "") && !is_numericint($_POST['idletimeout'])) 
230
		$input_errors[] = "The idle timeout value must be an integer.";
231
	if ($_POST['pppoe_resethour'] <> "" && !is_numericint($_POST['pppoe_resethour']) && 
232
		$_POST['pppoe_resethour'] >= 0 && $_POST['pppoe_resethour'] <=23) 
233
		$input_errors[] = gettext("A valid PPPoE reset hour must be specified (0-23).");
234
	if ($_POST['pppoe_resetminute'] <> "" && !is_numericint($_POST['pppoe_resetminute']) && 
235
		$_POST['pppoe_resetminute'] >= 0 && $_POST['pppoe_resetminute'] <=59) 
236
		$input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59).");
237
	if ($_POST['pppoe_resetdate'] <> "" && !is_numeric(str_replace("/", "", $_POST['pppoe_resetdate']))) 
238
		$input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy).");
239
	if (($_POST['localip'] && !is_ipaddr($_POST['localip']))) 
240
		$input_errors[] = "A valid PPTP local IP address must be specified.";
241
	if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) 
242
		$input_errors[] = "A valid PPTP subnet bit count must be specified.";
243
	if (($_POST['gateway'] && !is_ipaddr($_POST['gateway']))) 
244
		$input_errors[] = "A valid PPTP remote IP address must be specified.";
245
/*
246
	if (($_POST['bandwidth'] != "") && !is_numericint($_POST['bandwidth'])) 
247
		$input_errors[] = "The bandwidth value must be an integer.";	
248
	if ($_POST['mtu'] && ($_POST['mtu'] < 576)) 
249
		$input_errors[] = "The MTU must be greater than 576 bytes.";
250
	if ($_POST['mru'] && ($_POST['mru'] < 576)) 
251
		$input_errors[] = "The MRU must be greater than 576 bytes.";
252
*/
253

  
254
/*
255
	foreach ($a_ppps as $ppp) {
256
		if (isset($id) && ($a_ppps[$id]) && ($a_ppps[$id] === $ppp))
257
			continue;
258

  
259
		if ($ppp['serialport'] == $_POST['serialport']) {
260
			$input_errors[] = "Serial port is in use";
261
			break;
262
		}
263
	}
264
*/	
265

  
266
	if (!$input_errors) {
267
		$ppp = array();
268
		$ppp['type'] = $_POST['type'];
269
		$ppp['ports'] = implode(',', $_POST['interfaces']);
270
		$ppp['username'] = $_POST['username'];
271
		$ppp['password'] = base64_encode($_POST['password']);
272
		$ppp['defaultgw'] = $_POST['defaultgw'] ? true : false;
273
		$ppp['ondemand'] = $_POST['ondemand'] ? true : false;
274
		if (!empty($_POST['idletimeout']))
275
			$ppp['idletimeout'] = $_POST['idletimeout'];
276
		else 
277
			unset($ppp['idletimeout']);
278
		$ppp['uptime'] = $_POST['uptime'] ? true : false;
279
		if (!empty($_POST['descr']))
280
			$ppp['descr'] = $_POST['descr'];
281
		else
282
			unset($ppp['descr']);
283
		switch($_POST['type']) {
284
			case "ppp":
285
				if (!empty($_POST['initstr']))
286
					$ppp['initstr'] = base64_encode($_POST['initstr']);
287
				else
288
					unset($ppp['initstr']);
289
				if (!empty($_POST['simpin'])) {
290
					$ppp['simpin'] = $_POST['simpin'];
291
					$ppp['pin-wait'] = $_POST['pin-wait'];
292
				} else {
293
					unset($ppp['simpin']);
294
					unset($ppp['pin-wait']);
295
				}
296
				
297
				if (!empty($_POST['apn'])){
298
					$ppp['apn'] = $_POST['apn'];
299
					if (!empty($_POST['apnum']))
300
						$ppp['apnum'] = $_POST['apnum'];
301
					else
302
						$ppp['apnum'] = "1";
303
				} else {
304
					unset($ppp['apn']);
305
					unset($ppp['apnum']);
306
				}
307
				$ppp['phone'] = $_POST['phone'];
308
				if (!empty($_POST['localip']))
309
					$ppp['localip'] = $_POST['localip'];
310
				else
311
					unset($ppp['localip']);
312
				if (!empty($_POST['gateway']))
313
					$ppp['gateway'] = $_POST['gateway'];
314
				else
315
					unset($ppp['gateway']);
316
				if (!empty($_POST['connect-timeout']))
317
					$ppp['connect-timeout'] = $_POST['connect-timeout'];
318
				else
319
					unset($ppp['connect-timeout']);
320
				break;
321
			case "pppoe":
322
				if (!empty($_POST['provider']))
323
					$ppp['provider'] = $_POST['provider'];
324
				else
325
					unset($ppp['provider']);
326
				handle_pppoe_reset();
327
				break;
328
			case "pptp":
329
				$ppp['localip'] = $_POST['localip'];
330
				$ppp['subnet'] = $_POST['subnet'];
331
				$ppp['gateway'] = $_POST['gateway'];
332
				break;
333
			default:
334
				break;
335
			
336
		}
337
		/* reset cron items if necessary */
338
		if (empty($_POST['pppoe_preset'])) {
339
			/* test whether a cron item exists and unset() it if necessary */
340
			$itemhash = getMPDCRONSettings();
341
			$item = $itemhash['ITEM'];
342
			if (isset($item))
343
				unset($config['cron']['item'][$itemhash['ID']]); 
344
		}
345
		$ppp['shortseq'] = $_POST['shortseq'] ? true : false;
346
		$ppp['acfcomp'] = $_POST['acfcomp'] ? true : false;
347
		$ppp['protocomp'] = $_POST['protocomp'] ? true : false;
348
		$ppp['vjcomp'] = $_POST['vjcomp'] ? true : false;
349
		$ppp['tcpmssfix'] = $_POST['tcpmssfix'] ? true : false;
350
		if (isset($_POST['bandwidth']))
351
			$ppp['bandwidth'] = implode(',', $_POST['bandwidth']);
352
		else 
353
			unset($ppp['bandwidth']);
354
		if (isset($_POST['mtu']))
355
			$ppp['mtu'] = implode(',', $_POST['mtu']);
356
		else 
357
			unset($ppp['mtu']);
358
		if (isset($_POST['mru']))
359
			$ppp['mru'] = implode(',', $_POST['mru']);
360
		else 
361
			unset($ppp['mru']);
362
			
363
			
364
        $iflist = get_configured_interface_list();
365
        /*
366
        foreach ($iflist as $if) {
367
        	if ($config['interfaces'][$if]['if'] == basename($a_ppps[$id]['port']))
368
				$config['interfaces'][$if]['if'] = basename($ppp['port']);
369
		}
370
		*/
371
		if (isset($id) && $a_ppps[$id])
372
			$a_ppps[$id] = $ppp;
373
		else
374
			$a_ppps[] = $ppp;
375

  
376
		write_config();
377

  
378
		header("Location: interfaces_mlppp.php");
379
		exit;
380
	}
381
} // end if($_POST)
382

  
383
function handle_pppoe_reset() {
384
	global $_POST, $config, $g, $ppp, $if;
385
	/* perform a periodic reset? */
386
	if(!isset($_POST['pppoe_preset'])) {
387
		setup_pppoe_reset_file($if, false);		
388
		return;
389
	}
390
	if (!is_array($config['cron']['item'])) 
391
		$config['cron']['item'] = array(); 
392
	$itemhash = getMPDCRONSettings();
393
	$item = $itemhash['ITEM'];
394
	if (empty($item)) 
395
		$item = array();
396
	if (isset($_POST['pppoe_pr_type']) && $_POST['pppoe_pr_type'] == "custom") {
397
		$ppp['pppoe-reset-type'] = "custom";
398
		$pconfig['pppoe_pr_custom'] = true;
399
		$item['minute'] = $_POST['pppoe_resetminute'];
400
		$item['hour'] = $_POST['pppoe_resethour'];
401
		if (isset($_POST['pppoe_resetdate']) && $_POST['pppoe_resetdate'] <> "" && strlen($_POST['pppoe_resetdate']) == 10) {
402
			$date = explode("/", $_POST['pppoe_resetdate']);
403
			$item['mday'] = $date[1];
404
			$item['month'] = $date[0];
405
		} else {
406
			$item['mday'] = "*";
407
			$item['month'] = "*";
408
		}
409
		$item['wday'] = "*";
410
		$item['who'] = "root";
411
		$item['command'] = CRON_PPPOE_CMD_FILE;
412
	} else if (isset($_POST['pppoe_pr_type']) && $_POST['pppoe_pr_type'] = "preset") {
413
		$ppp['pppoe-reset-type'] = "preset";
414
		$pconfig['pppoe_pr_preset'] = true;
415
		switch ($_POST['pppoe_pr_preset_val']) {
416
			case "monthly":
417
				$item['minute'] = "0";
418
				$item['hour'] = "0";
419
				$item['mday'] = "1";
420
				$item['month'] = "*";
421
				$item['wday'] = "*";
422
				$item['who'] = "root";
423
				$item['command'] = CRON_PPPOE_CMD_FILE;
424
				break;
425
	        case "weekly":
426
				$item['minute'] = "0";
427
				$item['hour'] = "0";
428
				$item['mday'] = "*";
429
				$item['month'] = "*";
430
				$item['wday'] = "0";
431
				$item['who'] = "root";
432
				$item['command'] = CRON_PPPOE_CMD_FILE;
433
				break;
434
			case "daily":
435
				$item['minute'] = "0";
436
				$item['hour'] = "0";
437
				$item['mday'] = "*";
438
				$item['month'] = "*";
439
				$item['wday'] = "*";
440
				$item['who'] = "root";
441
				$item['command'] = CRON_PPPOE_CMD_FILE;
442
				break;
443
			case "hourly":
444
				$item['minute'] = "0";
445
				$item['hour'] = "*";
446
				$item['mday'] = "*";
447
				$item['month'] = "*";
448
				$item['wday'] = "*";
449
				$item['who'] = "root";
450
				$item['command'] = CRON_PPPOE_CMD_FILE;
451
				break;
452
		} // end switch
453
	} // end if
454
	if (isset($itemhash['ID'])) 
455
		$config['cron']['item'][$itemhash['ID']] = $item;
456
	else 
457
		$config['cron']['item'][] = $item;
458
	/* finally install the pppoerestart file */
459
	if (isset($_POST['pppoe_preset'])) {
460
		setup_pppoe_reset_file($if, true);
461
		//$ppp['pppoe_reset'] = true;
462
		$ppp['pppoe_preset'] = true;
463
		sigkillbypid("{$g['varrun_path']}/cron.pid", "HUP");
464
	} else {
465
		//unset($ppp['pppoe_reset']);
466
		unset($ppp['pppoe_preset']);		
467
		setup_pppoe_reset_file($if, false);	
468
	}
469
}
470

  
471
$closehead = false;
472
$pgtitle = array("Interfaces","MLPPP","Edit");
473
include("head.inc");
474

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

  
477
?>
478
	<script type="text/javascript" >
479
		document.observe("dom:loaded", function() { updateType(<?php echo "'{$pconfig['type']}'";?>); });
480
	</script>
481
</head>
482
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" >
483
<?php include("fbegin.inc"); ?>
484
<?php if ($input_errors) print_input_errors($input_errors); ?>
485
	<form action="interfaces_mlppp_edit.php" method="post" name="iform" id="iform">
486
	  <table id="interfacetable" width="100%" border="0" cellpadding="6" cellspacing="0">
487
		<tr>
488
			<td colspan="2" valign="top" class="listtopic">MLPPP configuration</td>
489
		</tr>
490
		<tr>
491
			<td valign="middle" class="vncell"><strong>Link Type</strong></td>
492
			<td class="vtable"> 
493
				<select name="type" onChange="updateType(this.value);" class="formselect" id="type">
494
				<?php 
495
					foreach ($types as $key => $opt) { 
496
						echo "<option onClick=\"updateType('{$key}');\"";
497
						if ($key == $pconfig['type']) 
498
							echo " selected";
499
						echo " value=\"{$key}\" >" . htmlspecialchars($opt) . "</option>";
500
					} 
501
				?>
502
				</select>
503
			</td>
504
		</tr>
505
		<tr name="interface" id="interface" >
506
			<td width="22%" valign="top" class="vncellreq">Link interface(s)</td>
507
			<td width="78%" class="vtable">
508
				<select valign="top" name="interfaces[]" multiple="true" class="formselect" size="4" onChange="show_hide_linkfields();">
509
					<option></option>
510
				</select>
511
				<a href='#' onClick='javascript:clear_selected("interfaces[]");'>Click here</a> to clear selection(s).
512
				<br/><span class="vexpl">Interfaces or ports participating in the multilink connection.</span>
513
				<span style="display:none" id="prefil_ppp">
514
				<p/>Click a link to fill in defaults for these carriers:&nbsp;
515
				<a href='#' onClick='javascript:prefill_att();'>ATT</A>
516
				<a href='#' onClick='javascript:prefill_sprint();'>Sprint</A>
517
				<a href='#' onClick='javascript:prefill_vzw();'>Verizon</A>
518
				</span>
519
			</td>
520
		</tr>
521
		<tr style="display:none" name="portlists" id="portlists">
522
			<td id="serialports"><?php
523
				$selected_ports = explode(",",$pconfig['interfaces']);
524
				$serial = glob("/dev/cua*");
525
				$modems = glob("/dev/modem*");
526
				$serialports = array_merge($serial, $modems);
527
				$serport_count = 0;
528
				foreach ($serialports as $port) {
529
					if(preg_match("/\.(lock|init)$/", $port))
530
						continue;
531
					$serport_count++;
532
					echo $port.",".trim($port);
533
					if (in_array($port,$selected_ports))
534
						echo ",1|";
535
					else
536
						echo ",|";
537
				}
538
				echo $serport_count;
539
			?></td>
540
			<td id="ports"><?php
541
				$port_count = 0;
542
				foreach ($portlist as $ifn => $ifinfo){
543
				$port_count++;
544
				//if (is_jumbo_capable($ifn)) {
545
					echo htmlspecialchars($ifn . " (" . $ifinfo['mac'] . ")") . ",{$ifn}";
546
					//echo "\"{$ifn}\"";
547
					if (stristr($pconfig['interfaces'], $ifn))
548
						echo ",1|";
549
					else
550
						echo ",|";
551
				}
552
				echo $port_count;
553
				if ($serport_count > $port_count)
554
					$port_count=$serport_count;
555
			?></td>
556
		</tr>
557
		<tr>
558
			<td width="22%" valign="top" class="vncell">Username</td>
559
			<td width="78%" class="vtable">
560
			<input name="username" type="text" class="formfld usr" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>">
561
			</td>
562
		</tr>
563
		<tr>
564
			<td width="22%" valign="top" class="vncell">Password</td>
565
			<td width="78%" class="vtable">
566
			<input name="password" type="password" class="formfld pwd" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>">
567
			</td>
568
		</tr>
569
		<tr>
570
			<td width="22%" valign="top" class="vncell">Gateway</td>
571
			<td width="78%" class="vtable">
572
				<input type="checkbox" value="on" id="defaultgw" name="defaultgw" <?php if (isset($pconfig['defaultgw'])) echo "checked"; ?>>This link will be used as the default gateway.
573
			</td>
574
		</tr>
575
		<tr>
576
		<td valign="top" class="vncell">Dial On Demand</td>
577
			<td class="vtable">
578
				<input type="checkbox" value="on" id="ondemand" name="ondemand" <?php if (isset($pconfig['ondemand'])) echo "checked"; ?>> Enable Dial-on-Demand mode
579
				<br/> <span class="vexpl">This option causes the interface to operate in dial-on-demand mode, allowing you to have a virtual full time connection. 
580
				The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected. </span>
581
			</td>
582
		</tr>
583
		<tr>
584
			<td valign="top" class="vncell">Idle Timeout</td>
585
			<td class="vtable">
586
				<input name="idletimeout" type="text" class="formfld unknown" id="idletimeout" size="6" value="<?=htmlspecialchars($pconfig['idletimeout']);?>"> seconds
587
				<br/> <span class="vexpl">Sets the idle timeout value for the bundle. If no incoming or outgoing packets are transmitted for the set number of seconds 
588
				the connection is brought down. An idle timeout of zero disables this feature. <bold>Default is 0.</bold>
589
				<br/>When the idle timeout occurs, if the dial-on-demand option is enabled, mpd goes back into dial-on-demand mode. Otherwise, the interface is brought down and all associated routes removed.</span>
590
			</td>
591
		</tr>
592
		<tr>
593
		<td valign="top" class="vncell">Uptime Logging</td>
594
			<td class="vtable">
595
				<input type="checkbox" value="on" id="uptime" name="uptime" <?php if (isset($pconfig['uptime'])) echo "checked"; ?>> Enable persistent logging of connection uptime.
596
				<br/> <span class="vexpl">This option causes cumulative uptime to be recorded and displayed on the Status Interfaces page.</span>
597
			</td>
598
		</tr>
599
		<tr>
600
			<td width="22%" valign="top" class="vncell">Description</td>
601
			<td width="78%" class="vtable">
602
				<input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>">
603
				<br/> <span class="vexpl">You may enter a description here for your reference (not parsed).</span>
604
			</td>
605
		</tr>
606
		<tr>
607
			<td colspan="2" valign="top" height="16"></td>
608
		</tr>
609
		<tr style="display:none" name="select" id="select">
610
		</tr>
611
		<tr style="display:none" name="ppp" id="ppp">
612
			<td colspan="2" style="padding:0px;">
613
				<table width="100%" border="0" cellpadding="6" cellspacing="0">
614
					<tr>
615
						<td colspan="2" valign="top" class="listtopic">PPP configuration</td>
616
					</tr>
617
					<tr>
618
						<td width="22%" valign="top" class="vncell">Init String</td>
619
						<td width="78%" class="vtable">
620
							<input type="text" size="40" class="formfld unknown" id="initstr" name="initstr" value="<?=htmlspecialchars($pconfig['initstr']);?>">
621
							<br/><span class="vexpl">Note: Enter the modem initialization string here. Do NOT include the "AT" string at the beginning of the command. Many modern USB 3G
622
							modems don't need an initialization string.</span>
623
						</td>
624
					</tr>
625
					<tr>
626
					  <td width="22%" valign="top" class="vncell">Sim PIN</td>
627
					  <td width="78%" class="vtable">
628
						<input name="simpin" type="text" class="formfld unknown" id="simpin" size="12" value="<?=htmlspecialchars($pconfig['simpin']);?>">
629
					</td>
630
					</tr>
631
					<tr>
632
					  <td width="22%" valign="top" class="vncell">Sim PIN wait</td>
633
					  <td width="78%" class="vtable">
634
						<input name="pin-wait" type="text" class="formfld unknown" id="pin-wait" size="2" value="<?=htmlspecialchars($pconfig['pin-wait']);?>">
635
						<br/><span class="vexpl">Note: Time to wait for SIM to discover network after PIN is sent to SIM (seconds).</span>
636
					</td>
637
					</tr>
638
					<tr>
639
					  <td width="22%" valign="top" class="vncell">Access Point Name (APN)</td>
640
					  <td width="78%" class="vtable">
641
						<input name="apn" type="text" class="formfld unknown" id="apn" size="40" value="<?=htmlspecialchars($pconfig['apn']);?>">
642
					</td>
643
					</tr>
644
					<tr>
645
					  <td width="22%" valign="top" class="vncell">APN number (optional)</td>
646
					  <td width="78%" class="vtable">
647
						<input name="apnum" type="text" class="formfld unknown" id="apnum" size="2" value="<?=htmlspecialchars($pconfig['apnum']);?>">
648
						<br/><span class="vexpl">Note: Defaults to 1 if you set APN above. Ignored if you set no APN above.</span>
649
					</td>
650
					</tr>
651
					<tr>
652
					  <td width="22%" valign="top" class="vncell">Phone Number</td>
653
					  <td width="78%" class="vtable">
654
						<input name="phone" type="text" class="formfld unknown" id="phone" size="40" value="<?=htmlspecialchars($pconfig['phone']);?>">
655
						<br/><span class="vexpl">Note: Typically (*99# or *99***# or *99***1#) for GSM networks and *777 for CDMA networks</span>
656
					  </td>
657
					</tr>
658
					<tr>
659
						<td width="22%" valign="top" class="vncell">Connection Timeout</td>
660
						<td width="78%" class="vtable">
661
							<input name="connect-timeout" type="text" class="formfld unknown" id="connect-timeout" size="2" value="<?=htmlspecialchars($pconfig['connect-timeout']);?>">
662
							<br/><span class="vexpl">Note: Enter timeout in seconds for connection to be established (sec.) Default is 45 sec.</span>
663
						</td>
664
					</tr>
665
				</table>
666
			</td>
667
		</tr>
668
		<tr style="display:none" name="pppoe" id="pppoe">
669
			<td colspan="2" style="padding:0px;">
670
				<table width="100%" border="0" cellpadding="6" cellspacing="0">
671
					<tr>
672
						<td colspan="2" valign="top" class="listtopic">PPPoE configuration</td>
673
					</tr>
674
					<tr>
675
						<td width="22%" valign="top" class="vncell">Service name</td>
676
						<td width="78%" class="vtable"><input name="provider" type="text" class="formfld unknown" id="provider" size="20" value="<?=htmlspecialchars($pconfig['provider']);?>">
677
							<br/> <span class="vexpl">Hint: this field can usually be left empty</span>
678
						</td>
679
					</tr>
680
					<tr>
681
						<td width="22%" valign="top" class="vncell"><?=gettext("Periodic reset");?></td>
682
						<td width="78%" class="vtable">
683
							<input name="pppoe_preset" type="checkbox" id="pppoe_preset" value="yes" <?php if ($pconfig['pppoe_preset']) echo "checked"; ?> onclick="show_more_settings(this,presetwrap);" />
684
							<?= gettext("enable periodic PPPoE resets"); ?>
685
							<br />
686
							<?php if ($pconfig['pppoe_preset']): ?>
687
							<table id="presetwrap" cellspacing="0" cellpadding="0" width="100%">
688
							<?php else: ?>
689
							<table id="presetwrap" cellspacing="0" cellpadding="0" width="100%" style="display: none;">
690
								<?php endif; ?>
691
								<tr>
692
									<td align="left" valign="top">
693
										<p style="margin: 4px; padding: 4px 0 4px 0; width: 94%;">
694
											<input name="pppoe_pr_type" type="radio" id="pppoe_pr_custom" value="custom" <?php if ($pconfig['pppoe_pr_custom']) echo "checked=\"checked\""; ?> onclick="if (this.checked) { Effect.Appear('pppoecustomwrap', { duration: 0.0 }); Effect.Fade('pppoepresetwrap', { duration: 0.0 }); }" /> 
695
												<?= gettext("provide a custom reset time"); ?>
696
												<br />
697
												<input name="pppoe_pr_type" type="radio" id="pppoe_pr_preset" value="preset" <?php if ($pconfig['pppoe_pr_preset']) echo "checked=\"checked\""; ?> onclick="if (this.checked) { Effect.Appear('pppoepresetwrap', { duration: 0.0 }); Effect.Fade('pppoecustomwrap', { duration: 0.0 }); }" /> 
698
													<?= gettext("select reset time from a preset"); ?>
699
												</p>
700
												<?php if ($pconfig['pppoe_pr_custom']): ?>
701
													<p style="margin: 2px; padding: 4px; width: 94%;" id="pppoecustomwrap">
702
													<?php else: ?>
703
														<p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoecustomwrap">
704
														<?php endif; ?>
705
														<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" /> 
706
														<?= gettext("hour (0-23)"); ?><br />
707
														<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" /> 
708
														<?= gettext("minute (0-59)"); ?><br />
709
														<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']);?>" /> 
710
														<?= gettext("reset at a specific date (mm/dd/yyyy)"); ?>
711
														<br />&nbsp;<br />
712
														<span class="red"><strong>Note: </strong></span>
713
														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.
714
													</p>
715
													<?php if ($pconfig['pppoe_pr_preset']): ?>
716
														<p style="margin: 2px; padding: 4px; width: 94%;" id="pppoepresetwrap">
717
														<?php else: ?>
718
															<p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoepresetwrap">
719
															<?php endif; ?>
720
															<input name="pppoe_pr_preset_val" type="radio" id="pppoe_monthly" value="monthly" <?php if ($pconfig['pppoe_monthly']) echo "checked=\"checked\""; ?> /> 
721
															<?= gettext("reset at each month ('0 0 1 * *')"); ?>
722
															<br />
723
															<input name="pppoe_pr_preset_val" type="radio" id="pppoe_weekly" value="weekly" <?php if ($pconfig['pppoe_weekly']) echo "checked=\"checked\""; ?> /> 
724
															<?= gettext("reset at each week ('0 0 * * 0')"); ?>
725
															<br />
726
															<input name="pppoe_pr_preset_val" type="radio" id="pppoe_daily" value="daily" <?php if ($pconfig['pppoe_daily']) echo "checked=\"checked\""; ?> /> 
727
															<?= gettext("reset at each day ('0 0 * * *')"); ?>
728
															<br />
729
															<input name="pppoe_pr_preset_val" type="radio" id="pppoe_hourly" value="hourly" <?php if ($pconfig['pppoe_hourly']) echo "checked=\"checked\""; ?> /> 
730
															<?= gettext("reset at each hour ('0 * * * *')"); ?>
731
											</p>
732
									</td>
733
								</tr>
734
							</table>
735
						</td>
736
					</tr>
737
				</table>
738
			</td>
739
		</tr>
740
		<tr style="display:none" name="pptp" id="pptp">
741
			<td colspan="2" style="padding:0px;">
742
				<table width="100%" border="0" cellpadding="6" cellspacing="0">
743
					<tr>
744
						<td colspan="2" valign="top" class="listtopic">PPTP configuration</td>
745
					</tr>
746
				</table>
747
			</td>
748
		</tr>
749
		<tr style="display:none" id="ipfields">
750
			<td colspan="2" style="padding:0px;">
751
				<table width="100%" border="0" cellpadding="6" cellspacing="0">
752
					<tr>
753
						<td width="22%" valign="top" class="vncell">Local IP address</td>
754
						<td width="78%" class="vtable"> 
755
							<input name="localip" type="text" class="formfld unknown" id="localip" size="20"  value="<?=htmlspecialchars($pconfig['localip']);?>">
756
							/
757
							<select style="display:none" name="subnet" class="formselect" id="subnet">
758
							<?php for ($i = 31; $i > 0; $i--): ?>
759
								<option value="<?=$i;?>"<?php if ($i == $pconfig['subnet']) echo "selected"; ?>><?=$i;?></option>
760
							<?php endfor; ?>
761
							</select>
762
							<br><span class="vexpl">Note: Local IP/subnet is required for PPTP connections. LocalIP is automatically assigned for PPP links if this field is empty.</span>
763
						</td>
764
					</tr>
765
					<tr>
766
						<td width="22%" valign="top" class="vncell">Remote IP (Gateway)</td>
767
						<td width="78%" class="vtable">
768
							<input name="gateway" type="text" class="formfld unknown" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>">
769
							<br><span class="vexpl">Note: This is where the packets will be routed. Remote IP is required for PPTP connections. Remote IP is automatically assigned for PPP links if this field is empty.</span>
770
						</td>
771
					</tr>
772
				</table>
773
			</td>
774
		<tr>
775
			<td colspan="2" valign="top" height="16"></td>
776
		</tr>
777
		<tr>
778
			<td colspan="2" valign="top" class="listtopic">Advanced Options</td>
779
		</tr>
780
		<tr>
781
			<td width="22%" valign="top" class="vncell">Compression</td>
782
			<td width="78%" class="vtable">
783
				<input type="checkbox" value="on" id="vjcomp" name="vjcomp" <?php if (isset($pconfig['vjcomp'])) echo "checked"; ?>>&nbsp;Enable vjcomp(compression).
784
				<br/> <span class="vexpl">This option enables Van Jacobson TCP header compression, which saves several bytes per TCP data packet. 
785
				You almost always want this option. This compression ineffective for TCP connections with enabled modern extensions like time 
786
				stamping or SACK, which modify TCP options between sequential packets.</span>
787
			</td>
788
		</tr>
789
		<tr>
790
			<td width="22%" valign="top" class="vncell">TCPmssFix</td>
791
			<td width="78%" class="vtable">
792
				<input type="checkbox" value="on" id="tcpmssfix" name="tcpmssfix" <?php if (isset($pconfig['tcpmssfix'])) echo "checked"; ?>>&nbsp;Enable tcpmssfix.
793
				<br/> <span class="vexpl">This option causes mpd to adjust incoming and outgoing TCP SYN segments so that the requested maximum segment size is not greater than the amount 
794
				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,
795
				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,
796
				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 
797
				gets to discover that it must reduce the fragment size or drop the IP Don't Fragment option from its outgoing data.</span>
798
			</td>
799
		</tr>
800
		<tr>
801
			<td width="22%" valign="top" class="vncell">ShortSeq</td>
802
			<td width="78%" class="vtable">
803
				<input type="checkbox" value="on" id="shortseq" name="shortseq" <?php if (isset($pconfig['shortseq'])) echo "checked"; ?>>&nbsp;Enable shortseq.
804
				<br/> <span class="vexpl">This option is only meaningful if multi-link PPP is negotiated. It proscribes shorter multi-link fragment headers, saving two bytes on every frame.</span>
805
			</td>
806
		</tr>
807
		<tr>
808
			<td width="22%" valign="top" class="vncell">ACFComp</td>
809
			<td width="78%" class="vtable">
810
				<input type="checkbox" value="on" id="acfcomp" name="acfcomp" <?php if (isset($pconfig['acfcomp'])) echo "checked"; ?>>&nbsp;Enable acfcomp.
811
				<br/> <span class="vexpl">Address and control field compression. This option only applies to asynchronous link types. It saves two bytes per frame.</span>
812
			</td>
813
		</tr>
814
		<tr>
815
			<td width="22%" valign="top" class="vncell">ProtoComp</td>
816
			<td width="78%" class="vtable">
817
				<input type="checkbox" value="on" id="protocomp" name="protocomp" <?php if (isset($pconfig['protocomp'])) echo "checked"; ?>>&nbsp;Enable protocomp(compression).
818
				<br/> <span class="vexpl">Protocol field compression. This option saves one byte per frame for most frames.</span>
819
			</td>
820
		</tr>
821

  
822
		<?php for($i=0; $i < $port_count; $i++) : ?>
823
		<tr style="display:none" id="link<?=$i;?>">
824
			<td width="22%" valign="top" id="linklabel<?=$i;?>" class="vncell"> Link Parameters</td>
825
			<td class="vtable">
826
				<table name="link_parameters" border="0" cellpadding="6" cellspacing="0">
827
					<tr>
828
						<td width="22%" valign="top" id="bandwidth<?=$i;?>" class="vncell"> Bandwidth</td>
829
						<td width="78%" class="vtable">
830
						<br/><input name="bandwidth[]" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['bandwidth'][$i]);?>">
831
						<br/> <span class="vexpl">Set Bandwidth for each link ONLY when links have different bandwidths.</span>
832
					  </td>
833
					</tr>
834
					<tr>
835
					  <td width="22%" valign="top" id="mtu<?=$i;?>" class="vncell"> MTU</td>
836
					  <td width="78%" class="vtable">
837
						<input name="mtu[]" type="text" class="formfld unknown" size="6" value="<?=htmlspecialchars($pconfig['mtu'][$i]);?>">
838
						<br> <span class="vexpl">Set MTU for each link if links have different bandwidths, otherwise, mtu will default to 1492.</span>
839
					  </td>
840
					</tr>
841
					<tr>
842
					  <td width="22%" valign="top" id="mru<?=$i;?>" class="vncell"> MRU</td>
843
					  <td width="78%" class="vtable">
844
						<input name="mru[]" type="text" class="formfld unknown" size="6" value="<?=htmlspecialchars($pconfig['mru'][$i]);?>">
845
						<br> <span class="vexpl">Set MRU for each link if links have different bandwidths, otherwise, mru will default to 1492.</span>
846
					  </td>
847
					</tr>
848
				</table
849
			</td>
850
		</tr>
851
		<?php endfor; ?>
852
		<tr>
853
			<td width="22%" valign="top">&nbsp;</td>
854
			<td width="78%">
855
				<input name="Submit" type="submit" class="formbtn" value="Save">
856
				<input type="button" value="Cancel" onclick="history.back()">
857
				<?php if (isset($id) && $a_ppps[$id]): ?>
858
					<input name="id" type="hidden" value="<?=$id;?>">
859
				<?php endif; ?>
860
			</td>
861
		</tr>
862
	</table>
863
</form>
864
<?php include("fend.inc"); ?>
865
</body>
866
</html>
usr/local/www/interfaces_ppps.php
1
<?php
2
/* $Id$ */
3
/*
4
	interfaces_ppps.php
5
	part of m0n0wall (http://m0n0.ch/wall)
6

  
7
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
8
	All rights reserved.
9

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

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

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

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

  
36
##|+PRIV
37
##|*IDENT=page-interfaces-ppps
38
##|*NAME=Interfaces: ppps page
39
##|*DESCR=Allow access to the 'Interfaces: ppps' page.
40
##|*MATCH=interfaces_ppps.php*
41
##|-PRIV
42

  
43
require("guiconfig.inc");
44

  
45
if (!is_array($config['ppps']['ppp']))
46
	$config['ppps']['ppp'] = array();
47

  
48
$a_ppps = &$config['ppps']['ppp'] ;
49

  
50
function ppp_inuse($num) {
51
	global $config, $g, $a_ppps;
52
	$iflist = get_configured_interface_list(false, true);
53
	foreach ($iflist as $if) {
54
		if (isset($config['interfaces'][$if]['ptpid']) && $config['interfaces'][$if]['ptpid'] == $a_ppps[$num]['ptpid'])
55
			return true;
56
	}
57
	return false;
58
}
59

  
60
if ($_GET['act'] == "del") {
61
	/* check if still in use */
62
	if (ppp_inuse($_GET['id'])) {
63
		$input_errors[] = "This point-to-point link cannot be deleted because it is still being used as an interface.";
64
	} else {
65
		unset($a_ppps[$_GET['id']]);
66
		write_config();
67
		header("Location: interfaces_ppps.php");
68
		exit;
69
	}
70
}
71

  
72
$pgtitle = "Interfaces: PPPs";
73
include("head.inc");
74

  
75
?>
76

  
77
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
78
<?php include("fbegin.inc"); ?>
79
<?php if ($input_errors) print_input_errors($input_errors); ?>
80
<table width="100%" border="0" cellpadding="0" cellspacing="0">
81
  <tr><td>
82
<?php
83
	$tab_array = array();
84
	$tab_array[0] = array("Interface assignments", false, "interfaces_assign.php");
85
	$tab_array[1] = array("Interface Groups", false, "interfaces_groups.php");
86
	$tab_array[2] = array("Wireless", false, "interfaces_wireless.php");
87
	$tab_array[3] = array("VLANs", false, "interfaces_vlan.php");
88
	$tab_array[4] = array("QinQs", false, "interfaces_qinq.php");
89
	$tab_array[5] = array("PPPs", false, "interfaces_ppps.php");
90
	$tab_array[6] = array("GRE", false, "interfaces_gre.php");
91
	$tab_array[7] = array("GIF", false, "interfaces_gif.php");
92
	$tab_array[8] = array("Bridges", false, "interfaces_bridge.php");
93
	$tab_array[9] = array("LAGG", false, "interfaces_lagg.php");
94
	display_top_tabs($tab_array);
95
?>
96
  </td></tr>
97
  <tr>
98
    <td>
99
	<div id="mainarea">
100
	<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
101
                <tr>
102
                	<td width="20%" class="listhdrr">Type</td>
103
                  <td width="20%" class="listhdrr">Interface(s)/Port(s)</td>
104
                  <td width="40%" class="listhdr">Description</td>
105
                  <td width="10%" class="list"></td>
106
				</tr>
107
			  <?php $i = 0; foreach ($a_ppps as $id => $ppp): ?>
108
                <tr  ondblclick="document.location='interfaces_ppps_edit.php?id=<?=$i;?>'">
109
                	<td class="listr">
110
					<?=htmlspecialchars($ppp['type']);?>
111
                  </td>
112
                  <td class="listr">
113
					<?=htmlspecialchars($ppp['ports']);?>
114
                  </td>
115
                  <td class="listbg">
116
                    <?=htmlspecialchars($ppp['descr']);?>&nbsp;
117
                  </td>
118
                  <td valign="middle" nowrap class="list"> <a href="interfaces_ppps_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a>
119
                     &nbsp;<a href="interfaces_ppps.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this PPP interface?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
120
				</tr>
121
			  <?php $i++; endforeach; ?>
122
                <tr>
123
                  <td class="list" colspan="3">&nbsp;</td>
124
                  <td class="list"> <a href="interfaces_ppps_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
125
				</tr>
126
              </table>
127
	      </div>
128
	</td>
129
	</tr>
130
</table>
131
<?php include("fend.inc"); ?>
132
</body>
133
</html>
usr/local/www/interfaces_ppps_edit.php
1
<?php
2
/* $Id$ */
3
/*
4
	interfaces_ppps_edit.php
5
	part of m0n0wall (http://m0n0.ch/wall)
6

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

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

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

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

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

  
37
##|+PRIV
38
##|*IDENT=page-interfaces-ppps-edit
39
##|*NAME=Interfaces: PPPs: Edit page
40
##|*DESCR=Allow access to the 'Interfaces: PPPs: Edit' page.
41
##|*MATCH=interfaces_ppps_edit.php*
42
##|-PRIV
43

  
44
require("guiconfig.inc");
45

  
46
define("CRON_PPPOE_CMD_FILE", "/conf/pppoe{$if}restart");
47
define("CRON_MONTHLY_PATTERN", "0 0 1 * *");
48
define("CRON_WEEKLY_PATTERN", "0 0 * * 0");
49
define("CRON_DAILY_PATTERN", "0 0 * * *");
50
define("CRON_HOURLY_PATTERN", "0 * * * *");
51

  
52
if (!is_array($config['ppps']['ppp']))
53
	$config['ppps']['ppp'] = array();
54

  
55
$a_ppps = &$config['ppps']['ppp'];
56

  
57
$portlist = get_interface_list();
58

  
59
function getMPDCRONSettings() {
60
	global $config;
61
	if (is_array($config['cron']['item'])) {
62
		for ($i = 0; $i < count($config['cron']['item']); $i++) {
63
			$item = $config['cron']['item'][$i];
64
			if (strpos($item['command'], CRON_PPPOE_CMD_FILE) !== false) {
65
				return array("ID" => $i, "ITEM" => $item);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff