1 |
860c4e80
|
Chris Buechler
|
<?php
|
2 |
|
|
/*
|
3 |
|
|
interfaces_lan.php
|
4 |
|
|
part of pfSense(http://pfsense.org)
|
5 |
|
|
|
6 |
|
|
Originally written by Adam Lebsack <adam at holonyx dot com>
|
7 |
|
|
Changes by Chris Buechler <cmb at pfsense dot org>
|
8 |
|
|
|
9 |
|
|
Copyright (C) 2004-2008 BSD Perimeter LLC.
|
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 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
35 |
|
|
##|*IDENT=page-interfaces-ppp
|
36 |
|
|
##|*NAME=Interfaces: PPP page
|
37 |
|
|
##|*DESCR=Allow access to the 'Interfaces: PPP' page.
|
38 |
|
|
##|*MATCH=interfaces_ppp.php*
|
39 |
|
|
##|-PRIV
|
40 |
|
|
|
41 |
|
|
|
42 |
860c4e80
|
Chris Buechler
|
require("guiconfig.inc");
|
43 |
|
|
|
44 |
|
|
if (!is_array($config['ppps']['ppp']))
|
45 |
|
|
$config['ppps']['ppp'] = array();
|
46 |
|
|
|
47 |
|
|
$a_ppps = &$config['ppps']['ppp'] ;
|
48 |
|
|
|
49 |
|
|
function ppp_inuse($num) {
|
50 |
|
|
global $config, $g;
|
51 |
|
|
|
52 |
fbb45bb0
|
Ermal Luçi
|
$iflist = get_configured_interface_list(false, true);
|
53 |
|
|
foreach ($iflist as $if) {
|
54 |
|
|
if ($config['interfaces'][$if]['if'] == "ppp{$num}")
|
55 |
860c4e80
|
Chris Buechler
|
return true;
|
56 |
|
|
}
|
57 |
|
|
|
58 |
|
|
return false;
|
59 |
|
|
}
|
60 |
|
|
|
61 |
|
|
if ($_GET['act'] == "del") {
|
62 |
|
|
/* check if still in use */
|
63 |
|
|
if (ppp_inuse($_GET['id'])) {
|
64 |
|
|
$input_errors[] = "This PPP interface cannot be deleted because it is still being used as an interface.";
|
65 |
|
|
} else {
|
66 |
f4758c47
|
Ermal Luçi
|
$realif = $a_ppps[$_GET['id']]['pppif'];
|
67 |
|
|
if ($realif <> "") {
|
68 |
|
|
$i = 0;
|
69 |
|
|
while ($realif != "ppp{$i}")
|
70 |
|
|
$i++;
|
71 |
|
|
if (file_exists("/var/run/ppp{$i}.pid")) {
|
72 |
|
|
$pid = trim(file_get_contents("/var/run/ppp{$i}.pid"));
|
73 |
|
|
mwexec("kill {$pid}");
|
74 |
|
|
}
|
75 |
|
|
}
|
76 |
|
|
|
77 |
|
|
mwexec("/sbin/ifconfig {$realif} destroy");
|
78 |
860c4e80
|
Chris Buechler
|
unset($a_ppps[$_GET['id']]);
|
79 |
|
|
|
80 |
|
|
write_config();
|
81 |
|
|
|
82 |
|
|
header("Location: interfaces_ppp.php");
|
83 |
|
|
exit;
|
84 |
|
|
}
|
85 |
|
|
}
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
$pgtitle = "Interfaces: PPP";
|
89 |
|
|
include("head.inc");
|
90 |
|
|
|
91 |
|
|
?>
|
92 |
|
|
|
93 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
94 |
|
|
<?php include("fbegin.inc"); ?>
|
95 |
|
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
96 |
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
97 |
|
|
<tr><td>
|
98 |
|
|
<?php
|
99 |
|
|
$tab_array = array();
|
100 |
|
|
$tab_array[0] = array("Interface assignments", false, "interfaces_assign.php");
|
101 |
0ec2fdf0
|
Ermal Lu?i
|
$tab_array[1] = array("Interface Groups", false, "interfaces_groups.php");
|
102 |
|
|
$tab_array[2] = array("VLANs", false, "interfaces_vlan.php");
|
103 |
5f1e1d26
|
Ermal Lu?i
|
$tab_array[3] = array("QinQs", false, "interfaces_qinq.php");
|
104 |
|
|
$tab_array[4] = array("PPP", true, "interfaces_ppp.php");
|
105 |
|
|
$tab_array[5] = array("GRE", false, "interfaces_gre.php");
|
106 |
|
|
$tab_array[6] = array("GIF", false, "interfaces_gif.php");
|
107 |
|
|
$tab_array[7] = array("Bridges", false, "interfaces_bridge.php");
|
108 |
|
|
$tab_array[8] = array("LAGG", false, "interfaces_lagg.php");
|
109 |
860c4e80
|
Chris Buechler
|
display_top_tabs($tab_array);
|
110 |
|
|
?>
|
111 |
|
|
</td></tr>
|
112 |
|
|
<tr>
|
113 |
|
|
<td>
|
114 |
|
|
<div id="mainarea">
|
115 |
|
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
|
116 |
|
|
<tr>
|
117 |
|
|
<td width="20%" class="listhdrr">Interface</td>
|
118 |
|
|
<td width="20%" class="listhdrr">Serial Port</td>
|
119 |
|
|
<td width="50%" class="listhdr">Description</td>
|
120 |
|
|
<td width="10%" class="list"></td>
|
121 |
|
|
</tr>
|
122 |
|
|
<?php $i = 0; foreach ($a_ppps as $id => $ppp): ?>
|
123 |
|
|
<tr>
|
124 |
|
|
<td class="listlr">
|
125 |
2cc504e1
|
Ermal Luçi
|
<?=htmlspecialchars($ppp['pppif']);?>
|
126 |
860c4e80
|
Chris Buechler
|
</td>
|
127 |
|
|
<td class="listr">
|
128 |
|
|
<?=htmlspecialchars($ppp['port']);?>
|
129 |
|
|
</td>
|
130 |
|
|
<td class="listbg">
|
131 |
|
|
<?=htmlspecialchars($ppp['descr']);?>
|
132 |
|
|
</td>
|
133 |
|
|
<td valign="middle" nowrap class="list"> <a href="interfaces_ppp_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a>
|
134 |
|
|
<a href="interfaces_ppp.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>
|
135 |
|
|
</tr>
|
136 |
|
|
<?php $i++; endforeach; ?>
|
137 |
|
|
<tr>
|
138 |
|
|
<td class="list" colspan="3"> </td>
|
139 |
|
|
<td class="list"> <a href="interfaces_ppp_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
|
140 |
|
|
</tr>
|
141 |
|
|
</table>
|
142 |
|
|
</div>
|
143 |
|
|
</td>
|
144 |
|
|
</tr>
|
145 |
|
|
</table>
|
146 |
|
|
<?php include("fend.inc"); ?>
|
147 |
|
|
</body>
|
148 |
|
|
</html>
|