1 |
589f92bb
|
gnhb
|
<?php
|
2 |
919d91f9
|
Phil Davis
|
/*
|
3 |
|
|
interfaces_ppps.php
|
4 |
|
|
*/
|
5 |
b9043cdc
|
Stephen Beaver
|
/* ====================================================================
|
6 |
|
|
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
|
7 |
191cb31d
|
Stephen Beaver
|
*
|
8 |
cb41dd63
|
Renato Botelho
|
* Some or all of this file is based on the m0n0wall project which is
|
9 |
|
|
* Copyright (c) 2004 Manuel Kasper (BSD 2 clause)
|
10 |
b9043cdc
|
Stephen Beaver
|
*
|
11 |
|
|
* Redistribution and use in source and binary forms, with or without modification,
|
12 |
|
|
* are permitted provided that the following conditions are met:
|
13 |
|
|
*
|
14 |
|
|
* 1. Redistributions of source code must retain the above copyright notice,
|
15 |
|
|
* this list of conditions and the following disclaimer.
|
16 |
|
|
*
|
17 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
18 |
|
|
* notice, this list of conditions and the following disclaimer in
|
19 |
|
|
* the documentation and/or other materials provided with the
|
20 |
|
|
* distribution.
|
21 |
|
|
*
|
22 |
|
|
* 3. All advertising materials mentioning features or use of this software
|
23 |
|
|
* must display the following acknowledgment:
|
24 |
|
|
* "This product includes software developed by the pfSense Project
|
25 |
|
|
* for use in the pfSense software distribution. (http://www.pfsense.org/).
|
26 |
|
|
*
|
27 |
|
|
* 4. The names "pfSense" and "pfSense Project" must not be used to
|
28 |
|
|
* endorse or promote products derived from this software without
|
29 |
|
|
* prior written permission. For written permission, please contact
|
30 |
|
|
* coreteam@pfsense.org.
|
31 |
|
|
*
|
32 |
|
|
* 5. Products derived from this software may not be called "pfSense"
|
33 |
|
|
* nor may "pfSense" appear in their names without prior written
|
34 |
|
|
* permission of the Electric Sheep Fencing, LLC.
|
35 |
|
|
*
|
36 |
|
|
* 6. Redistributions of any form whatsoever must retain the following
|
37 |
|
|
* acknowledgment:
|
38 |
|
|
*
|
39 |
|
|
* "This product includes software developed by the pfSense Project
|
40 |
|
|
* for use in the pfSense software distribution (http://www.pfsense.org/).
|
41 |
|
|
*
|
42 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
|
43 |
|
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
44 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
45 |
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
|
46 |
|
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
47 |
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
48 |
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
49 |
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
50 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
51 |
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
52 |
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
53 |
|
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
54 |
|
|
*
|
55 |
|
|
* ====================================================================
|
56 |
|
|
*
|
57 |
|
|
*/
|
58 |
589f92bb
|
gnhb
|
|
59 |
|
|
##|+PRIV
|
60 |
42809b4a
|
gnhb
|
##|*IDENT=page-interfaces-ppps
|
61 |
9599211d
|
jim-p
|
##|*NAME=Interfaces: PPPs
|
62 |
|
|
##|*DESCR=Allow access to the 'Interfaces: PPPs' page.
|
63 |
42809b4a
|
gnhb
|
##|*MATCH=interfaces_ppps.php*
|
64 |
589f92bb
|
gnhb
|
##|-PRIV
|
65 |
|
|
|
66 |
|
|
require("guiconfig.inc");
|
67 |
cfb9eb9f
|
Carlos Eduardo Ramos
|
require_once("functions.inc");
|
68 |
589f92bb
|
gnhb
|
|
69 |
e51cea69
|
gnhb
|
function ppp_inuse($num) {
|
70 |
c5ce8398
|
jim-p
|
global $config, $g;
|
71 |
006d23d4
|
sbeaver
|
|
72 |
42809b4a
|
gnhb
|
$iflist = get_configured_interface_list(false, true);
|
73 |
2af86dda
|
Phil Davis
|
if (!is_array($config['ppps']['ppp'])) {
|
74 |
c5ce8398
|
jim-p
|
return false;
|
75 |
2af86dda
|
Phil Davis
|
}
|
76 |
c5ce8398
|
jim-p
|
|
77 |
42809b4a
|
gnhb
|
foreach ($iflist as $if) {
|
78 |
2af86dda
|
Phil Davis
|
if ($config['interfaces'][$if]['if'] == $config['ppps']['ppp'][$num]['if']) {
|
79 |
42809b4a
|
gnhb
|
return true;
|
80 |
2af86dda
|
Phil Davis
|
}
|
81 |
42809b4a
|
gnhb
|
}
|
82 |
006d23d4
|
sbeaver
|
|
83 |
42809b4a
|
gnhb
|
return false;
|
84 |
589f92bb
|
gnhb
|
}
|
85 |
|
|
|
86 |
|
|
if ($_GET['act'] == "del") {
|
87 |
|
|
/* check if still in use */
|
88 |
e51cea69
|
gnhb
|
if (ppp_inuse($_GET['id'])) {
|
89 |
f2047bd0
|
Rafael Lucas
|
$input_errors[] = gettext("This point-to-point link cannot be deleted because it is still being used as an interface.");
|
90 |
c5ce8398
|
jim-p
|
} elseif (is_array($config['ppps']['ppp']) && is_array($config['ppps']['ppp'][$_GET['id']])) {
|
91 |
|
|
|
92 |
|
|
unset($config['ppps']['ppp'][$_GET['id']]['pppoe-reset-type']);
|
93 |
|
|
handle_pppoe_reset($config['ppps']['ppp'][$_GET['id']]);
|
94 |
|
|
unset($config['ppps']['ppp'][$_GET['id']]);
|
95 |
589f92bb
|
gnhb
|
write_config();
|
96 |
42809b4a
|
gnhb
|
header("Location: interfaces_ppps.php");
|
97 |
589f92bb
|
gnhb
|
exit;
|
98 |
|
|
}
|
99 |
|
|
}
|
100 |
|
|
|
101 |
2af86dda
|
Phil Davis
|
if (!is_array($config['ppps']['ppp'])) {
|
102 |
c5ce8398
|
jim-p
|
$config['ppps']['ppp'] = array();
|
103 |
2af86dda
|
Phil Davis
|
}
|
104 |
c5ce8398
|
jim-p
|
$a_ppps = $config['ppps']['ppp'];
|
105 |
|
|
|
106 |
aa82505e
|
Phil Davis
|
$pgtitle = array(gettext("Interfaces"), gettext("PPPs"));
|
107 |
b32dd0a6
|
jim-p
|
$shortcut_section = "interfaces";
|
108 |
589f92bb
|
gnhb
|
include("head.inc");
|
109 |
|
|
|
110 |
68a7712c
|
sbeaver
|
$tab_array = array();
|
111 |
006d23d4
|
sbeaver
|
$tab_array[] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
|
112 |
|
|
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
|
113 |
|
|
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
|
114 |
|
|
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
|
115 |
|
|
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
|
116 |
|
|
$tab_array[] = array(gettext("PPPs"), true, "interfaces_ppps.php");
|
117 |
|
|
$tab_array[] = array(gettext("GRE"), false, "interfaces_gre.php");
|
118 |
|
|
$tab_array[] = array(gettext("GIF"), false, "interfaces_gif.php");
|
119 |
|
|
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
|
120 |
|
|
$tab_array[] = array(gettext("LAGG"), false, "interfaces_lagg.php");
|
121 |
68a7712c
|
sbeaver
|
display_top_tabs($tab_array);
|
122 |
589f92bb
|
gnhb
|
?>
|
123 |
68a7712c
|
sbeaver
|
<div class="table-responsive">
|
124 |
|
|
<table class="table table-striped table-hover table-condensed">
|
125 |
|
|
<thead>
|
126 |
|
|
<tr>
|
127 |
|
|
<th><?=gettext("Interface"); ?></th>
|
128 |
|
|
<th><?=gettext("Interface(s)/Port(s)"); ?></th>
|
129 |
|
|
<th><?=gettext("Description"); ?></th>
|
130 |
|
|
<th></th>
|
131 |
|
|
</tr>
|
132 |
|
|
</thead>
|
133 |
|
|
<tbody>
|
134 |
|
|
<?php
|
135 |
|
|
|
136 |
|
|
$i = 0;
|
137 |
589f92bb
|
gnhb
|
|
138 |
68a7712c
|
sbeaver
|
foreach ($a_ppps as $id => $ppp) {
|
139 |
|
|
?>
|
140 |
006d23d4
|
sbeaver
|
<tr>
|
141 |
68a7712c
|
sbeaver
|
<td>
|
142 |
|
|
<?=htmlspecialchars($ppp['if'])?>
|
143 |
|
|
</td>
|
144 |
|
|
<td>
|
145 |
|
|
<?php
|
146 |
|
|
$portlist = explode(",", $ppp['ports']);
|
147 |
|
|
foreach ($portlist as $portid => $port) {
|
148 |
aa82505e
|
Phil Davis
|
if ($port != get_real_interface($port) && $ppp['type'] != "ppp") {
|
149 |
68a7712c
|
sbeaver
|
$portlist[$portid] = convert_friendly_interface_to_friendly_descr($port);
|
150 |
aa82505e
|
Phil Davis
|
}
|
151 |
68a7712c
|
sbeaver
|
}
|
152 |
|
|
echo htmlspecialchars(implode(",", $portlist));
|
153 |
|
|
?>
|
154 |
|
|
</td>
|
155 |
|
|
<td>
|
156 |
|
|
<?=htmlspecialchars($ppp['descr'])?>
|
157 |
|
|
</td>
|
158 |
|
|
<td>
|
159 |
c35bc186
|
heper
|
<a class="fa fa-pencil" title="<?=gettext('Edit PPP interface')?>" href="interfaces_ppps_edit.php?id=<?=$i?>"></a>
|
160 |
33f0b0d5
|
Stephen Beaver
|
<a class="fa fa-trash" title="<?=gettext('Delete PPP interface')?>" href="interfaces_ppps.php?act=del&id=<?=$i?>"></a>
|
161 |
68a7712c
|
sbeaver
|
</td>
|
162 |
|
|
</tr>
|
163 |
589f92bb
|
gnhb
|
<?php
|
164 |
68a7712c
|
sbeaver
|
$i++;
|
165 |
|
|
}
|
166 |
589f92bb
|
gnhb
|
?>
|
167 |
68a7712c
|
sbeaver
|
</tbody>
|
168 |
|
|
</table>
|
169 |
006d23d4
|
sbeaver
|
|
170 |
c10cb196
|
Stephen Beaver
|
<nav class="action-buttons">
|
171 |
2ec8f0ba
|
Stephen Beaver
|
<a href="interfaces_ppps_edit.php" class="btn btn-success btn-sm">
|
172 |
9d5a20cf
|
heper
|
<i class="fa fa-plus icon-embed-btn"></i>
|
173 |
2ec8f0ba
|
Stephen Beaver
|
<?=gettext("Add")?>
|
174 |
|
|
</a>
|
175 |
006d23d4
|
sbeaver
|
</nav>
|
176 |
68a7712c
|
sbeaver
|
</div>
|
177 |
|
|
<?php
|
178 |
|
|
include("foot.inc");
|