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-2024 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 $g;
|
40
|
|
41
|
$ppp_config = config_get_path('ppps/ppp');
|
42
|
$if_config = config_get_path('interfaces');
|
43
|
$iflist = get_configured_interface_list(true);
|
44
|
if (!is_array($ppp_config)) {
|
45
|
return false;
|
46
|
}
|
47
|
|
48
|
foreach ($iflist as $if) {
|
49
|
if ($if_config[$if]['if'] == $ppp_config[$num]['if']) {
|
50
|
return true;
|
51
|
}
|
52
|
}
|
53
|
|
54
|
return false;
|
55
|
}
|
56
|
|
57
|
if ($_POST['act'] == "del") {
|
58
|
$this_ppp_config = config_get_path("ppps/ppp/{$_POST['id']}");
|
59
|
/* check if still in use */
|
60
|
if (ppp_inuse($_POST['id'])) {
|
61
|
$input_errors[] = gettext("This point-to-point link cannot be deleted because it is still being used as an interface.");
|
62
|
} elseif (is_array($this_ppp_config)) {
|
63
|
|
64
|
config_del_path("ppps/ppp/{$_POST['id']}/pppoe-reset-type");
|
65
|
handle_pppoe_reset($this_ppp_config);
|
66
|
config_del_path("ppps/ppp/{$_POST['id']}");
|
67
|
write_config("PPP interface deleted");
|
68
|
header("Location: interfaces_ppps.php");
|
69
|
exit;
|
70
|
}
|
71
|
}
|
72
|
|
73
|
config_init_path('ppps/ppp');
|
74
|
|
75
|
$pgtitle = array(gettext("Interfaces"), gettext("PPPs"));
|
76
|
$shortcut_section = "interfaces";
|
77
|
include("head.inc");
|
78
|
|
79
|
if ($input_errors) {
|
80
|
print_input_errors($input_errors);
|
81
|
}
|
82
|
|
83
|
$tab_array = array();
|
84
|
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
|
85
|
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
|
86
|
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
|
87
|
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
|
88
|
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
|
89
|
$tab_array[] = array(gettext("PPPs"), true, "interfaces_ppps.php");
|
90
|
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
|
91
|
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
|
92
|
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
|
93
|
$tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php");
|
94
|
display_top_tabs($tab_array);
|
95
|
?>
|
96
|
<div class="panel panel-default">
|
97
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext('PPP Interfaces')?></h2></div>
|
98
|
<div class="panel-body">
|
99
|
<div class="table-responsive">
|
100
|
<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
|
101
|
<thead>
|
102
|
<tr>
|
103
|
<th><?=gettext("Interface"); ?></th>
|
104
|
<th><?=gettext("Interface(s)/Port(s)"); ?></th>
|
105
|
<th><?=gettext("Description"); ?></th>
|
106
|
<th><?=gettext("Actions")?></th>
|
107
|
</tr>
|
108
|
</thead>
|
109
|
<tbody>
|
110
|
<?php
|
111
|
|
112
|
$i = 0;
|
113
|
|
114
|
|
115
|
foreach (config_get_path('ppps/ppp', []) as $ppp) {
|
116
|
?>
|
117
|
<tr>
|
118
|
<td>
|
119
|
<?=htmlspecialchars($ppp['if'])?>
|
120
|
</td>
|
121
|
<td>
|
122
|
<?php
|
123
|
$portlist = array_filter(explode(",", $ppp['ports']));
|
124
|
foreach ($portlist as $portid => $port) {
|
125
|
if (($ppp['type'] != "ppp") && ($port != get_real_interface($port))) {
|
126
|
$portlist[$portid] = convert_friendly_interface_to_friendly_descr($port);
|
127
|
}
|
128
|
}
|
129
|
echo htmlspecialchars(implode(",", $portlist));
|
130
|
?>
|
131
|
</td>
|
132
|
<td>
|
133
|
<?=htmlspecialchars($ppp['descr'])?>
|
134
|
</td>
|
135
|
<td>
|
136
|
<a class="fa-solid fa-pencil" title="<?=gettext('Edit PPP interface')?>" href="interfaces_ppps_edit.php?id=<?=$i?>"></a>
|
137
|
<a class="fa-solid fa-trash-can" title="<?=gettext('Delete PPP interface')?>" href="interfaces_ppps.php?act=del&id=<?=$i?>" usepost></a>
|
138
|
</td>
|
139
|
</tr>
|
140
|
<?php
|
141
|
$i++;
|
142
|
}
|
143
|
?>
|
144
|
</tbody>
|
145
|
</table>
|
146
|
</div>
|
147
|
</div>
|
148
|
</div>
|
149
|
|
150
|
<nav class="action-buttons">
|
151
|
<a href="interfaces_ppps_edit.php" class="btn btn-success btn-sm">
|
152
|
<i class="fa-solid fa-plus icon-embed-btn"></i>
|
153
|
<?=gettext("Add")?>
|
154
|
</a>
|
155
|
</nav>
|
156
|
|
157
|
<?php
|
158
|
include("foot.inc");
|