Project

General

Profile

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