1
|
<?php
|
2
|
/*
|
3
|
* interfaces_gre.php
|
4
|
*
|
5
|
* part of pfSense (https://www.pfsense.org)
|
6
|
* Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
|
7
|
* All rights reserved.
|
8
|
*
|
9
|
* 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
|
*
|
13
|
* http://www.apache.org/licenses/LICENSE-2.0
|
14
|
*
|
15
|
* 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
|
*/
|
21
|
|
22
|
##|+PRIV
|
23
|
##|*IDENT=page-interfaces-gre
|
24
|
##|*NAME=Interfaces: GRE
|
25
|
##|*DESCR=Allow access to the 'Interfaces: GRE' page.
|
26
|
##|*MATCH=interfaces_gre.php*
|
27
|
##|-PRIV
|
28
|
|
29
|
require_once("guiconfig.inc");
|
30
|
require_once("functions.inc");
|
31
|
|
32
|
if (!is_array($config['gres']['gre'])) {
|
33
|
$config['gres']['gre'] = array();
|
34
|
}
|
35
|
|
36
|
$a_gres = &$config['gres']['gre'] ;
|
37
|
|
38
|
function gre_inuse($num) {
|
39
|
global $config, $a_gres;
|
40
|
|
41
|
$iflist = get_configured_interface_list(false, true);
|
42
|
foreach ($iflist as $if) {
|
43
|
if ($config['interfaces'][$if]['if'] == $a_gres[$num]['greif']) {
|
44
|
return true;
|
45
|
}
|
46
|
}
|
47
|
|
48
|
return false;
|
49
|
}
|
50
|
|
51
|
if ($_GET['act'] == "del") {
|
52
|
if (!isset($_GET['id'])) {
|
53
|
$input_errors[] = gettext("Wrong parameters supplied");
|
54
|
} else if (empty($a_gres[$_GET['id']])) {
|
55
|
$input_errors[] = gettext("Wrong index supplied");
|
56
|
/* check if still in use */
|
57
|
} else if (gre_inuse($_GET['id'])) {
|
58
|
$input_errors[] = gettext("This GRE tunnel cannot be deleted because it is still being used as an interface.");
|
59
|
} else {
|
60
|
pfSense_interface_destroy($a_gres[$_GET['id']]['greif']);
|
61
|
unset($a_gres[$_GET['id']]);
|
62
|
|
63
|
write_config();
|
64
|
|
65
|
header("Location: interfaces_gre.php");
|
66
|
exit;
|
67
|
}
|
68
|
}
|
69
|
|
70
|
$pgtitle = array(gettext("Interfaces"), gettext("GREs"));
|
71
|
$shortcut_section = "interfaces";
|
72
|
include("head.inc");
|
73
|
if ($input_errors) {
|
74
|
print_input_errors($input_errors);
|
75
|
}
|
76
|
|
77
|
$tab_array = array();
|
78
|
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
|
79
|
$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
|
$tab_array[] = array(gettext("GREs"), true, "interfaces_gre.php");
|
85
|
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
|
86
|
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
|
87
|
$tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php");
|
88
|
display_top_tabs($tab_array);
|
89
|
?>
|
90
|
<div class="panel panel-default">
|
91
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext('GRE Interfaces')?></h2></div>
|
92
|
<div class="panel-body">
|
93
|
<div class="table-responsive">
|
94
|
<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
|
95
|
<thead>
|
96
|
<tr>
|
97
|
<th><?=gettext("Interface"); ?></th>
|
98
|
<th><?=gettext("Tunnel to …"); ?></th>
|
99
|
<th><?=gettext("Description"); ?></th>
|
100
|
<th><?=gettext("Actions"); ?></th>
|
101
|
</tr>
|
102
|
</thead>
|
103
|
<tbody>
|
104
|
<?php foreach ($a_gres as $i => $gre):
|
105
|
if (substr($gre['if'], 0, 4) == "_vip") {
|
106
|
$if = convert_real_interface_to_friendly_descr(get_real_interface($gre['if']));
|
107
|
} else {
|
108
|
$if = $gre['if'];
|
109
|
}
|
110
|
?>
|
111
|
<tr>
|
112
|
<td>
|
113
|
<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($if))?>
|
114
|
</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
|
<?php endforeach; ?>
|
127
|
</tbody>
|
128
|
</table>
|
129
|
</div>
|
130
|
</div>
|
131
|
</div>
|
132
|
|
133
|
<nav class="action-buttons">
|
134
|
<a href="interfaces_gre_edit.php" class="btn btn-success btn-sm">
|
135
|
<i class="fa fa-plus icon-embed-btn"></i>
|
136
|
<?=gettext("Add")?>
|
137
|
</a>
|
138
|
</nav>
|
139
|
<?php
|
140
|
include("foot.inc");
|