1
|
<?php
|
2
|
/*
|
3
|
* interfaces_ppps.php
|
4
|
*
|
5
|
* part of pfSense (https://www.pfsense.org)
|
6
|
* Copyright (c) 2004-2013 BSD Perimeter
|
7
|
* Copyright (c) 2013-2016 Electric Sheep Fencing
|
8
|
* Copyright (c) 2014-2020 Rubicon Communications, LLC (Netgate)
|
9
|
* All rights reserved.
|
10
|
*
|
11
|
* originally based on m0n0wall (http://m0n0.ch/wall)
|
12
|
* Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
13
|
* All rights reserved.
|
14
|
*
|
15
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
16
|
* you may not use this file except in compliance with the License.
|
17
|
* You may obtain a copy of the License at
|
18
|
*
|
19
|
* http://www.apache.org/licenses/LICENSE-2.0
|
20
|
*
|
21
|
* Unless required by applicable law or agreed to in writing, software
|
22
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
23
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
24
|
* See the License for the specific language governing permissions and
|
25
|
* limitations under the License.
|
26
|
*/
|
27
|
|
28
|
##|+PRIV
|
29
|
##|*IDENT=page-interfaces-ppps
|
30
|
##|*NAME=Interfaces: PPPs
|
31
|
##|*DESCR=Allow access to the 'Interfaces: PPPs' page.
|
32
|
##|*MATCH=interfaces_ppps.php*
|
33
|
##|-PRIV
|
34
|
|
35
|
require_once("guiconfig.inc");
|
36
|
require_once("functions.inc");
|
37
|
|
38
|
function ppp_inuse($num) {
|
39
|
global $config, $g;
|
40
|
|
41
|
$iflist = get_configured_interface_list(true);
|
42
|
if (!is_array($config['ppps']['ppp'])) {
|
43
|
return false;
|
44
|
}
|
45
|
|
46
|
foreach ($iflist as $if) {
|
47
|
if ($config['interfaces'][$if]['if'] == $config['ppps']['ppp'][$num]['if']) {
|
48
|
return true;
|
49
|
}
|
50
|
}
|
51
|
|
52
|
return false;
|
53
|
}
|
54
|
|
55
|
if ($_POST['act'] == "del") {
|
56
|
/* check if still in use */
|
57
|
if (ppp_inuse($_POST['id'])) {
|
58
|
$input_errors[] = gettext("This point-to-point link cannot be deleted because it is still being used as an interface.");
|
59
|
} elseif (is_array($config['ppps']['ppp']) && is_array($config['ppps']['ppp'][$_POST['id']])) {
|
60
|
|
61
|
unset($config['ppps']['ppp'][$_POST['id']]['pppoe-reset-type']);
|
62
|
handle_pppoe_reset($config['ppps']['ppp'][$_POST['id']]);
|
63
|
unset($config['ppps']['ppp'][$_POST['id']]);
|
64
|
write_config();
|
65
|
header("Location: interfaces_ppps.php");
|
66
|
exit;
|
67
|
}
|
68
|
}
|
69
|
|
70
|
if (!is_array($config['ppps'])) {
|
71
|
$config['ppps'] = array();
|
72
|
}
|
73
|
|
74
|
if (!is_array($config['ppps']['ppp'])) {
|
75
|
$config['ppps']['ppp'] = array();
|
76
|
}
|
77
|
|
78
|
$a_ppps = $config['ppps']['ppp'];
|
79
|
|
80
|
$pgtitle = array(gettext("Interfaces"), gettext("PPPs"));
|
81
|
$shortcut_section = "interfaces";
|
82
|
include("head.inc");
|
83
|
|
84
|
$tab_array = array();
|
85
|
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
|
86
|
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
|
87
|
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
|
88
|
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
|
89
|
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
|
90
|
$tab_array[] = array(gettext("PPPs"), true, "interfaces_ppps.php");
|
91
|
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
|
92
|
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
|
93
|
$tab_array[] = array(gettext("VXLANs"), false, "interfaces_vxlan.php");
|
94
|
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
|
95
|
$tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php");
|
96
|
display_top_tabs($tab_array);
|
97
|
?>
|
98
|
<div class="panel panel-default">
|
99
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext('PPP Interfaces')?></h2></div>
|
100
|
<div class="panel-body">
|
101
|
<div class="table-responsive">
|
102
|
<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
|
103
|
<thead>
|
104
|
<tr>
|
105
|
<th><?=gettext("Interface"); ?></th>
|
106
|
<th><?=gettext("Interface(s)/Port(s)"); ?></th>
|
107
|
<th><?=gettext("Description"); ?></th>
|
108
|
<th><?=gettext("Actions")?></th>
|
109
|
</tr>
|
110
|
</thead>
|
111
|
<tbody>
|
112
|
<?php
|
113
|
|
114
|
$i = 0;
|
115
|
|
116
|
|
117
|
if (is_array($a_ppps)) {
|
118
|
foreach ($a_ppps as $id => $ppp) {
|
119
|
?>
|
120
|
<tr>
|
121
|
<td>
|
122
|
<?=htmlspecialchars($ppp['if'])?>
|
123
|
</td>
|
124
|
<td>
|
125
|
<?php
|
126
|
$portlist = explode(",", $ppp['ports']);
|
127
|
foreach ($portlist as $portid => $port) {
|
128
|
if ($port != get_real_interface($port) && $ppp['type'] != "ppp") {
|
129
|
$portlist[$portid] = convert_friendly_interface_to_friendly_descr($port);
|
130
|
}
|
131
|
}
|
132
|
echo htmlspecialchars(implode(",", $portlist));
|
133
|
?>
|
134
|
</td>
|
135
|
<td>
|
136
|
<?=htmlspecialchars($ppp['descr'])?>
|
137
|
</td>
|
138
|
<td>
|
139
|
<a class="fa fa-pencil" title="<?=gettext('Edit PPP interface')?>" href="interfaces_ppps_edit.php?id=<?=$i?>"></a>
|
140
|
<a class="fa fa-trash" title="<?=gettext('Delete PPP interface')?>" href="interfaces_ppps.php?act=del&id=<?=$i?>" usepost></a>
|
141
|
</td>
|
142
|
</tr>
|
143
|
<?php
|
144
|
$i++;
|
145
|
}
|
146
|
}
|
147
|
?>
|
148
|
</tbody>
|
149
|
</table>
|
150
|
</div>
|
151
|
</div>
|
152
|
</div>
|
153
|
|
154
|
<nav class="action-buttons">
|
155
|
<a href="interfaces_ppps_edit.php" class="btn btn-success btn-sm">
|
156
|
<i class="fa fa-plus icon-embed-btn"></i>
|
157
|
<?=gettext("Add")?>
|
158
|
</a>
|
159
|
</nav>
|
160
|
|
161
|
<?php
|
162
|
include("foot.inc");
|