1 |
ead45104
|
Ermal Luçi
|
<?php
|
2 |
|
|
/*
|
3 |
c5d81585
|
Renato Botelho
|
* interfaces_gre.php
|
4 |
b9043cdc
|
Stephen Beaver
|
*
|
5 |
c5d81585
|
Renato Botelho
|
* part of pfSense (https://www.pfsense.org)
|
6 |
81299b5c
|
Renato Botelho
|
* Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
|
7 |
c5d81585
|
Renato Botelho
|
* All rights reserved.
|
8 |
b9043cdc
|
Stephen Beaver
|
*
|
9 |
b12ea3fb
|
Renato Botelho
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
10 |
|
|
* you may not use this file except in compliance with the License.
|
11 |
|
|
* You may obtain a copy of the License at
|
12 |
b9043cdc
|
Stephen Beaver
|
*
|
13 |
b12ea3fb
|
Renato Botelho
|
* http://www.apache.org/licenses/LICENSE-2.0
|
14 |
b9043cdc
|
Stephen Beaver
|
*
|
15 |
b12ea3fb
|
Renato Botelho
|
* Unless required by applicable law or agreed to in writing, software
|
16 |
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
17 |
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18 |
|
|
* See the License for the specific language governing permissions and
|
19 |
|
|
* limitations under the License.
|
20 |
b9043cdc
|
Stephen Beaver
|
*/
|
21 |
ead45104
|
Ermal Luçi
|
|
22 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
23 |
|
|
##|*IDENT=page-interfaces-gre
|
24 |
5230f468
|
jim-p
|
##|*NAME=Interfaces: GRE
|
25 |
6b07c15a
|
Matthew Grooms
|
##|*DESCR=Allow access to the 'Interfaces: GRE' page.
|
26 |
|
|
##|*MATCH=interfaces_gre.php*
|
27 |
|
|
##|-PRIV
|
28 |
|
|
|
29 |
c81ef6e2
|
Phil Davis
|
require_once("guiconfig.inc");
|
30 |
cea05ee9
|
Carlos Eduardo Ramos
|
require_once("functions.inc");
|
31 |
ead45104
|
Ermal Luçi
|
|
32 |
2af86dda
|
Phil Davis
|
if (!is_array($config['gres']['gre'])) {
|
33 |
ead45104
|
Ermal Luçi
|
$config['gres']['gre'] = array();
|
34 |
2af86dda
|
Phil Davis
|
}
|
35 |
ead45104
|
Ermal Luçi
|
|
36 |
|
|
$a_gres = &$config['gres']['gre'] ;
|
37 |
|
|
|
38 |
|
|
function gre_inuse($num) {
|
39 |
c059940b
|
Erik Fonnesbeck
|
global $config, $a_gres;
|
40 |
ead45104
|
Ermal Luçi
|
|
41 |
|
|
$iflist = get_configured_interface_list(false, true);
|
42 |
|
|
foreach ($iflist as $if) {
|
43 |
2af86dda
|
Phil Davis
|
if ($config['interfaces'][$if]['if'] == $a_gres[$num]['greif']) {
|
44 |
ead45104
|
Ermal Luçi
|
return true;
|
45 |
2af86dda
|
Phil Davis
|
}
|
46 |
ead45104
|
Ermal Luçi
|
}
|
47 |
|
|
|
48 |
|
|
return false;
|
49 |
|
|
}
|
50 |
|
|
|
51 |
|
|
if ($_GET['act'] == "del") {
|
52 |
2af86dda
|
Phil Davis
|
if (!isset($_GET['id'])) {
|
53 |
b148c54a
|
Sjon Hortensius
|
$input_errors[] = gettext("Wrong parameters supplied");
|
54 |
2af86dda
|
Phil Davis
|
} else if (empty($a_gres[$_GET['id']])) {
|
55 |
b148c54a
|
Sjon Hortensius
|
$input_errors[] = gettext("Wrong index supplied");
|
56 |
ead45104
|
Ermal Luçi
|
/* check if still in use */
|
57 |
2af86dda
|
Phil Davis
|
} else if (gre_inuse($_GET['id'])) {
|
58 |
dcc85b42
|
Rafael Lucas
|
$input_errors[] = gettext("This GRE tunnel cannot be deleted because it is still being used as an interface.");
|
59 |
ead45104
|
Ermal Luçi
|
} else {
|
60 |
414aa359
|
Renato Botelho
|
pfSense_interface_destroy($a_gres[$_GET['id']]['greif']);
|
61 |
ead45104
|
Ermal Luçi
|
unset($a_gres[$_GET['id']]);
|
62 |
|
|
|
63 |
|
|
write_config();
|
64 |
|
|
|
65 |
|
|
header("Location: interfaces_gre.php");
|
66 |
|
|
exit;
|
67 |
|
|
}
|
68 |
|
|
}
|
69 |
|
|
|
70 |
26b4bef8
|
k-paulius
|
$pgtitle = array(gettext("Interfaces"), gettext("GREs"));
|
71 |
b32dd0a6
|
jim-p
|
$shortcut_section = "interfaces";
|
72 |
ead45104
|
Ermal Luçi
|
include("head.inc");
|
73 |
aa82505e
|
Phil Davis
|
if ($input_errors) {
|
74 |
1332ace6
|
sbeaver
|
print_input_errors($input_errors);
|
75 |
aa82505e
|
Phil Davis
|
}
|
76 |
1332ace6
|
sbeaver
|
|
77 |
|
|
$tab_array = array();
|
78 |
26b4bef8
|
k-paulius
|
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
|
79 |
b148c54a
|
Sjon Hortensius
|
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
|
80 |
|
|
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
|
81 |
|
|
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
|
82 |
|
|
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
|
83 |
|
|
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
|
84 |
26b4bef8
|
k-paulius
|
$tab_array[] = array(gettext("GREs"), true, "interfaces_gre.php");
|
85 |
|
|
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
|
86 |
b148c54a
|
Sjon Hortensius
|
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
|
87 |
26b4bef8
|
k-paulius
|
$tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php");
|
88 |
1332ace6
|
sbeaver
|
display_top_tabs($tab_array);
|
89 |
ead45104
|
Ermal Luçi
|
?>
|
90 |
060ed238
|
Stephen Beaver
|
<div class="panel panel-default">
|
91 |
70dc5cd6
|
Phil Davis
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext('GRE Interfaces')?></h2></div>
|
92 |
060ed238
|
Stephen Beaver
|
<div class="panel-body">
|
93 |
|
|
<div class="table-responsive">
|
94 |
1c10ce97
|
PiBa-NL
|
<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
|
95 |
060ed238
|
Stephen Beaver
|
<thead>
|
96 |
|
|
<tr>
|
97 |
|
|
<th><?=gettext("Interface"); ?></th>
|
98 |
|
|
<th><?=gettext("Tunnel to …"); ?></th>
|
99 |
|
|
<th><?=gettext("Description"); ?></th>
|
100 |
70dc5cd6
|
Phil Davis
|
<th><?=gettext("Actions"); ?></th>
|
101 |
060ed238
|
Stephen Beaver
|
</tr>
|
102 |
|
|
</thead>
|
103 |
|
|
<tbody>
|
104 |
2a5960b0
|
Luiz Otavio O Souza
|
<?php foreach ($a_gres as $i => $gre):
|
105 |
d9901ff4
|
Chris Buechler
|
if (substr($gre['if'], 0, 4) == "_vip") {
|
106 |
2a5960b0
|
Luiz Otavio O Souza
|
$if = convert_real_interface_to_friendly_descr(get_real_interface($gre['if']));
|
107 |
d9901ff4
|
Chris Buechler
|
} else {
|
108 |
2a5960b0
|
Luiz Otavio O Souza
|
$if = $gre['if'];
|
109 |
d9901ff4
|
Chris Buechler
|
}
|
110 |
2a5960b0
|
Luiz Otavio O Souza
|
?>
|
111 |
060ed238
|
Stephen Beaver
|
<tr>
|
112 |
|
|
<td>
|
113 |
2a5960b0
|
Luiz Otavio O Souza
|
<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($if))?>
|
114 |
060ed238
|
Stephen Beaver
|
</td>
|
115 |
|
|
<td>
|
116 |
|
|
<?=htmlspecialchars($gre['remote-addr'])?>
|
117 |
|
|
</td>
|
118 |
|
|
<td>
|
119 |
|
|
<?=htmlspecialchars($gre['descr'])?>
|
120 |
|
|
</td>
|
121 |
|
|
<td>
|
122 |
|
|
<a class="fa fa-pencil" title="<?=gettext('Edit GRE interface')?>" href="interfaces_gre_edit.php?id=<?=$i?>"></a>
|
123 |
|
|
<a class="fa fa-trash" title="<?=gettext('Delete GRE interface')?>" href="interfaces_gre.php?act=del&id=<?=$i?>"></a>
|
124 |
|
|
</td>
|
125 |
|
|
</tr>
|
126 |
b148c54a
|
Sjon Hortensius
|
<?php endforeach; ?>
|
127 |
060ed238
|
Stephen Beaver
|
</tbody>
|
128 |
|
|
</table>
|
129 |
|
|
</div>
|
130 |
|
|
</div>
|
131 |
1332ace6
|
sbeaver
|
</div>
|
132 |
b148c54a
|
Sjon Hortensius
|
|
133 |
c10cb196
|
Stephen Beaver
|
<nav class="action-buttons">
|
134 |
2ec8f0ba
|
Stephen Beaver
|
<a href="interfaces_gre_edit.php" class="btn btn-success btn-sm">
|
135 |
9d5a20cf
|
heper
|
<i class="fa fa-plus icon-embed-btn"></i>
|
136 |
b148c54a
|
Sjon Hortensius
|
<?=gettext("Add")?>
|
137 |
|
|
</a>
|
138 |
|
|
</nav>
|
139 |
1332ace6
|
sbeaver
|
<?php
|
140 |
f9078962
|
heper
|
include("foot.inc");
|