1 |
ead45104
|
Ermal Luçi
|
<?php
|
2 |
|
|
/*
|
3 |
aaec5634
|
Renato Botelho
|
* interfaces_gre.php
|
4 |
b9043cdc
|
Stephen Beaver
|
*
|
5 |
aaec5634
|
Renato Botelho
|
* part of pfSense (https://www.pfsense.org)
|
6 |
2a2396a6
|
Renato Botelho
|
* Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
|
7 |
aaec5634
|
Renato Botelho
|
* All rights reserved.
|
8 |
b9043cdc
|
Stephen Beaver
|
*
|
9 |
aaec5634
|
Renato Botelho
|
* Redistribution and use in source and binary forms, with or without
|
10 |
|
|
* modification, are permitted provided that the following conditions are met:
|
11 |
b9043cdc
|
Stephen Beaver
|
*
|
12 |
aaec5634
|
Renato Botelho
|
* 1. Redistributions of source code must retain the above copyright notice,
|
13 |
|
|
* this list of conditions and the following disclaimer.
|
14 |
b9043cdc
|
Stephen Beaver
|
*
|
15 |
aaec5634
|
Renato Botelho
|
* 2. Redistributions in binary form must reproduce the above copyright
|
16 |
|
|
* notice, this list of conditions and the following disclaimer in
|
17 |
|
|
* the documentation and/or other materials provided with the
|
18 |
|
|
* distribution.
|
19 |
b9043cdc
|
Stephen Beaver
|
*
|
20 |
aaec5634
|
Renato Botelho
|
* 3. All advertising materials mentioning features or use of this software
|
21 |
|
|
* must display the following acknowledgment:
|
22 |
|
|
* "This product includes software developed by the pfSense Project
|
23 |
|
|
* for use in the pfSense® software distribution. (http://www.pfsense.org/).
|
24 |
b9043cdc
|
Stephen Beaver
|
*
|
25 |
aaec5634
|
Renato Botelho
|
* 4. The names "pfSense" and "pfSense Project" must not be used to
|
26 |
|
|
* endorse or promote products derived from this software without
|
27 |
|
|
* prior written permission. For written permission, please contact
|
28 |
|
|
* coreteam@pfsense.org.
|
29 |
b9043cdc
|
Stephen Beaver
|
*
|
30 |
aaec5634
|
Renato Botelho
|
* 5. Products derived from this software may not be called "pfSense"
|
31 |
|
|
* nor may "pfSense" appear in their names without prior written
|
32 |
|
|
* permission of the Electric Sheep Fencing, LLC.
|
33 |
b9043cdc
|
Stephen Beaver
|
*
|
34 |
aaec5634
|
Renato Botelho
|
* 6. Redistributions of any form whatsoever must retain the following
|
35 |
|
|
* acknowledgment:
|
36 |
b9043cdc
|
Stephen Beaver
|
*
|
37 |
aaec5634
|
Renato Botelho
|
* "This product includes software developed by the pfSense Project
|
38 |
|
|
* for use in the pfSense software distribution (http://www.pfsense.org/).
|
39 |
b9043cdc
|
Stephen Beaver
|
*
|
40 |
aaec5634
|
Renato Botelho
|
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
|
41 |
|
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
42 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
43 |
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
|
44 |
|
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
45 |
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
46 |
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
47 |
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
48 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
49 |
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
50 |
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
51 |
|
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
52 |
b9043cdc
|
Stephen Beaver
|
*/
|
53 |
ead45104
|
Ermal Luçi
|
|
54 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
55 |
|
|
##|*IDENT=page-interfaces-gre
|
56 |
5230f468
|
jim-p
|
##|*NAME=Interfaces: GRE
|
57 |
6b07c15a
|
Matthew Grooms
|
##|*DESCR=Allow access to the 'Interfaces: GRE' page.
|
58 |
|
|
##|*MATCH=interfaces_gre.php*
|
59 |
|
|
##|-PRIV
|
60 |
|
|
|
61 |
aceaf18c
|
Phil Davis
|
require_once("guiconfig.inc");
|
62 |
cea05ee9
|
Carlos Eduardo Ramos
|
require_once("functions.inc");
|
63 |
ead45104
|
Ermal Luçi
|
|
64 |
2af86dda
|
Phil Davis
|
if (!is_array($config['gres']['gre'])) {
|
65 |
ead45104
|
Ermal Luçi
|
$config['gres']['gre'] = array();
|
66 |
2af86dda
|
Phil Davis
|
}
|
67 |
ead45104
|
Ermal Luçi
|
|
68 |
|
|
$a_gres = &$config['gres']['gre'] ;
|
69 |
|
|
|
70 |
|
|
function gre_inuse($num) {
|
71 |
c059940b
|
Erik Fonnesbeck
|
global $config, $a_gres;
|
72 |
ead45104
|
Ermal Luçi
|
|
73 |
|
|
$iflist = get_configured_interface_list(false, true);
|
74 |
|
|
foreach ($iflist as $if) {
|
75 |
2af86dda
|
Phil Davis
|
if ($config['interfaces'][$if]['if'] == $a_gres[$num]['greif']) {
|
76 |
ead45104
|
Ermal Luçi
|
return true;
|
77 |
2af86dda
|
Phil Davis
|
}
|
78 |
ead45104
|
Ermal Luçi
|
}
|
79 |
|
|
|
80 |
|
|
return false;
|
81 |
|
|
}
|
82 |
|
|
|
83 |
|
|
if ($_GET['act'] == "del") {
|
84 |
2af86dda
|
Phil Davis
|
if (!isset($_GET['id'])) {
|
85 |
b148c54a
|
Sjon Hortensius
|
$input_errors[] = gettext("Wrong parameters supplied");
|
86 |
2af86dda
|
Phil Davis
|
} else if (empty($a_gres[$_GET['id']])) {
|
87 |
b148c54a
|
Sjon Hortensius
|
$input_errors[] = gettext("Wrong index supplied");
|
88 |
ead45104
|
Ermal Luçi
|
/* check if still in use */
|
89 |
2af86dda
|
Phil Davis
|
} else if (gre_inuse($_GET['id'])) {
|
90 |
dcc85b42
|
Rafael Lucas
|
$input_errors[] = gettext("This GRE tunnel cannot be deleted because it is still being used as an interface.");
|
91 |
ead45104
|
Ermal Luçi
|
} else {
|
92 |
636a410c
|
Renato Botelho
|
pfSense_interface_destroy($a_gres[$_GET['id']]['greif']);
|
93 |
ead45104
|
Ermal Luçi
|
unset($a_gres[$_GET['id']]);
|
94 |
|
|
|
95 |
|
|
write_config();
|
96 |
|
|
|
97 |
|
|
header("Location: interfaces_gre.php");
|
98 |
|
|
exit;
|
99 |
|
|
}
|
100 |
|
|
}
|
101 |
|
|
|
102 |
26b4bef8
|
k-paulius
|
$pgtitle = array(gettext("Interfaces"), gettext("GREs"));
|
103 |
b32dd0a6
|
jim-p
|
$shortcut_section = "interfaces";
|
104 |
ead45104
|
Ermal Luçi
|
include("head.inc");
|
105 |
aa82505e
|
Phil Davis
|
if ($input_errors) {
|
106 |
1332ace6
|
sbeaver
|
print_input_errors($input_errors);
|
107 |
aa82505e
|
Phil Davis
|
}
|
108 |
1332ace6
|
sbeaver
|
|
109 |
|
|
$tab_array = array();
|
110 |
26b4bef8
|
k-paulius
|
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
|
111 |
b148c54a
|
Sjon Hortensius
|
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
|
112 |
|
|
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
|
113 |
|
|
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
|
114 |
|
|
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
|
115 |
|
|
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
|
116 |
26b4bef8
|
k-paulius
|
$tab_array[] = array(gettext("GREs"), true, "interfaces_gre.php");
|
117 |
|
|
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
|
118 |
b148c54a
|
Sjon Hortensius
|
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
|
119 |
26b4bef8
|
k-paulius
|
$tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php");
|
120 |
1332ace6
|
sbeaver
|
display_top_tabs($tab_array);
|
121 |
ead45104
|
Ermal Luçi
|
?>
|
122 |
060ed238
|
Stephen Beaver
|
<div class="panel panel-default">
|
123 |
70dc5cd6
|
Phil Davis
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext('GRE Interfaces')?></h2></div>
|
124 |
060ed238
|
Stephen Beaver
|
<div class="panel-body">
|
125 |
|
|
<div class="table-responsive">
|
126 |
91677170
|
PiBa-NL
|
<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
|
127 |
060ed238
|
Stephen Beaver
|
<thead>
|
128 |
|
|
<tr>
|
129 |
|
|
<th><?=gettext("Interface"); ?></th>
|
130 |
|
|
<th><?=gettext("Tunnel to …"); ?></th>
|
131 |
|
|
<th><?=gettext("Description"); ?></th>
|
132 |
70dc5cd6
|
Phil Davis
|
<th><?=gettext("Actions"); ?></th>
|
133 |
060ed238
|
Stephen Beaver
|
</tr>
|
134 |
|
|
</thead>
|
135 |
|
|
<tbody>
|
136 |
2a5960b0
|
Luiz Otavio O Souza
|
<?php foreach ($a_gres as $i => $gre):
|
137 |
d9901ff4
|
Chris Buechler
|
if (substr($gre['if'], 0, 4) == "_vip") {
|
138 |
2a5960b0
|
Luiz Otavio O Souza
|
$if = convert_real_interface_to_friendly_descr(get_real_interface($gre['if']));
|
139 |
d9901ff4
|
Chris Buechler
|
} else {
|
140 |
2a5960b0
|
Luiz Otavio O Souza
|
$if = $gre['if'];
|
141 |
d9901ff4
|
Chris Buechler
|
}
|
142 |
2a5960b0
|
Luiz Otavio O Souza
|
?>
|
143 |
060ed238
|
Stephen Beaver
|
<tr>
|
144 |
|
|
<td>
|
145 |
2a5960b0
|
Luiz Otavio O Souza
|
<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($if))?>
|
146 |
060ed238
|
Stephen Beaver
|
</td>
|
147 |
|
|
<td>
|
148 |
|
|
<?=htmlspecialchars($gre['remote-addr'])?>
|
149 |
|
|
</td>
|
150 |
|
|
<td>
|
151 |
|
|
<?=htmlspecialchars($gre['descr'])?>
|
152 |
|
|
</td>
|
153 |
|
|
<td>
|
154 |
|
|
<a class="fa fa-pencil" title="<?=gettext('Edit GRE interface')?>" href="interfaces_gre_edit.php?id=<?=$i?>"></a>
|
155 |
|
|
<a class="fa fa-trash" title="<?=gettext('Delete GRE interface')?>" href="interfaces_gre.php?act=del&id=<?=$i?>"></a>
|
156 |
|
|
</td>
|
157 |
|
|
</tr>
|
158 |
b148c54a
|
Sjon Hortensius
|
<?php endforeach; ?>
|
159 |
060ed238
|
Stephen Beaver
|
</tbody>
|
160 |
|
|
</table>
|
161 |
|
|
</div>
|
162 |
|
|
</div>
|
163 |
1332ace6
|
sbeaver
|
</div>
|
164 |
b148c54a
|
Sjon Hortensius
|
|
165 |
c10cb196
|
Stephen Beaver
|
<nav class="action-buttons">
|
166 |
2ec8f0ba
|
Stephen Beaver
|
<a href="interfaces_gre_edit.php" class="btn btn-success btn-sm">
|
167 |
9d5a20cf
|
heper
|
<i class="fa fa-plus icon-embed-btn"></i>
|
168 |
b148c54a
|
Sjon Hortensius
|
<?=gettext("Add")?>
|
169 |
|
|
</a>
|
170 |
|
|
</nav>
|
171 |
1332ace6
|
sbeaver
|
<?php
|
172 |
f9078962
|
heper
|
include("foot.inc");
|