1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
interfaces_ppps.php
|
5
|
part of m0n0wall (http://m0n0.ch/wall)
|
6
|
|
7
|
Copyright (C) 2013-2015 Electric Sheep Fencing, LP
|
8
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
9
|
All rights reserved.
|
10
|
|
11
|
Redistribution and use in source and binary forms, with or without
|
12
|
modification, 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 the
|
19
|
documentation and/or other materials provided with the distribution.
|
20
|
|
21
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
22
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
23
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
24
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
25
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
26
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
27
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
28
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
29
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
30
|
POSSIBILITY OF SUCH DAMAGE.
|
31
|
*/
|
32
|
/*
|
33
|
pfSense_BUILDER_BINARIES: /sbin/ifconfig
|
34
|
pfSense_MODULE: interfaces
|
35
|
*/
|
36
|
|
37
|
##|+PRIV
|
38
|
##|*IDENT=page-interfaces-ppps
|
39
|
##|*NAME=Interfaces: ppps page
|
40
|
##|*DESCR=Allow access to the 'Interfaces: ppps' page.
|
41
|
##|*MATCH=interfaces_ppps.php*
|
42
|
##|-PRIV
|
43
|
|
44
|
require("guiconfig.inc");
|
45
|
require_once("functions.inc");
|
46
|
|
47
|
function ppp_inuse($num) {
|
48
|
global $config, $g;
|
49
|
|
50
|
$iflist = get_configured_interface_list(false, true);
|
51
|
if (!is_array($config['ppps']['ppp'])) {
|
52
|
return false;
|
53
|
}
|
54
|
|
55
|
foreach ($iflist as $if) {
|
56
|
if ($config['interfaces'][$if]['if'] == $config['ppps']['ppp'][$num]['if']) {
|
57
|
return true;
|
58
|
}
|
59
|
}
|
60
|
|
61
|
return false;
|
62
|
}
|
63
|
|
64
|
if ($_GET['act'] == "del") {
|
65
|
/* check if still in use */
|
66
|
if (ppp_inuse($_GET['id'])) {
|
67
|
$input_errors[] = gettext("This point-to-point link cannot be deleted because it is still being used as an interface.");
|
68
|
} elseif (is_array($config['ppps']['ppp']) && is_array($config['ppps']['ppp'][$_GET['id']])) {
|
69
|
|
70
|
unset($config['ppps']['ppp'][$_GET['id']]['pppoe-reset-type']);
|
71
|
handle_pppoe_reset($config['ppps']['ppp'][$_GET['id']]);
|
72
|
unset($config['ppps']['ppp'][$_GET['id']]);
|
73
|
write_config();
|
74
|
header("Location: interfaces_ppps.php");
|
75
|
exit;
|
76
|
}
|
77
|
}
|
78
|
|
79
|
if (!is_array($config['ppps']['ppp'])) {
|
80
|
$config['ppps']['ppp'] = array();
|
81
|
}
|
82
|
$a_ppps = $config['ppps']['ppp'];
|
83
|
|
84
|
$pgtitle = array(gettext("Interfaces"),gettext("PPPs"));
|
85
|
$shortcut_section = "interfaces";
|
86
|
include("head.inc");
|
87
|
|
88
|
$tab_array = array();
|
89
|
$tab_array[] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
|
90
|
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
|
91
|
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
|
92
|
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
|
93
|
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
|
94
|
$tab_array[] = array(gettext("PPPs"), true, "interfaces_ppps.php");
|
95
|
$tab_array[] = array(gettext("GRE"), false, "interfaces_gre.php");
|
96
|
$tab_array[] = array(gettext("GIF"), false, "interfaces_gif.php");
|
97
|
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
|
98
|
$tab_array[] = array(gettext("LAGG"), false, "interfaces_lagg.php");
|
99
|
display_top_tabs($tab_array);
|
100
|
?>
|
101
|
<div class="table-responsive">
|
102
|
<table class="table table-striped table-hover table-condensed">
|
103
|
<thead>
|
104
|
<tr>
|
105
|
<th><?=gettext("Interface"); ?></th>
|
106
|
<th><?=gettext("Interface(s)/Port(s)"); ?></th>
|
107
|
<th><?=gettext("Description"); ?></th>
|
108
|
<th></th>
|
109
|
</tr>
|
110
|
</thead>
|
111
|
<tbody>
|
112
|
<?php
|
113
|
|
114
|
$i = 0;
|
115
|
|
116
|
foreach ($a_ppps as $id => $ppp) {
|
117
|
?>
|
118
|
<tr>
|
119
|
<td>
|
120
|
<?=htmlspecialchars($ppp['if'])?>
|
121
|
</td>
|
122
|
<td>
|
123
|
<?php
|
124
|
$portlist = explode(",", $ppp['ports']);
|
125
|
foreach ($portlist as $portid => $port) {
|
126
|
if ($port != get_real_interface($port) && $ppp['type'] != "ppp")
|
127
|
$portlist[$portid] = convert_friendly_interface_to_friendly_descr($port);
|
128
|
}
|
129
|
echo htmlspecialchars(implode(",", $portlist));
|
130
|
?>
|
131
|
</td>
|
132
|
<td>
|
133
|
<?=htmlspecialchars($ppp['descr'])?>
|
134
|
</td>
|
135
|
<td>
|
136
|
<a href="interfaces_ppps_edit.php?id=<?=$i?>" class="btn btn-default btn-xs"><?=gettext("Edit")?></a>
|
137
|
<a href="interfaces_ppps.php?act=del&id=<?=$i?>" class="btn btn-danger btn-xs"><?=gettext("Delete")?></a>
|
138
|
</td>
|
139
|
</tr>
|
140
|
<?php
|
141
|
$i++;
|
142
|
}
|
143
|
?>
|
144
|
</tbody>
|
145
|
</table>
|
146
|
|
147
|
<nav class="action-buttons">
|
148
|
<a href="interfaces_ppps_edit.php" class="btn btn-success"><?=gettext("Add")?></a>
|
149
|
</nav>
|
150
|
</div>
|
151
|
<?php
|
152
|
include("foot.inc");
|
153
|
|