Project

General

Profile

Download (4.48 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
 * interfaces_vxlan.php
4
 *
5
 * part of pfSense (https://www.pfsense.org)
6
 * Copyright (c) 2004-2013 BSD Perimeter
7
 * Copyright (c) 2013-2016 Electric Sheep Fencing
8
 * Copyright (c) 2014-2021 Rubicon Communications, LLC (Netgate)
9
 * All rights reserved.
10
 *
11
 * 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
 *
15
 * http://www.apache.org/licenses/LICENSE-2.0
16
 *
17
 * 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
 */
23

    
24
##|+PRIV
25
##|*IDENT=page-interfaces-vxlan
26
##|*NAME=Interfaces: VXLAN
27
##|*DESCR=Allow access to the 'Interfaces: VXLAN' page.
28
##|*MATCH=interfaces_vxlan.php*
29
##|-PRIV
30

    
31
require_once("guiconfig.inc");
32
require_once("functions.inc");
33

    
34
init_config_arr(array('vxlans', 'vxlan'));
35
$a_vxlans = &$config['vxlans']['vxlan'] ;
36

    
37
function vxlan_inuse($num) {
38
	global $config, $a_vxlans;
39

    
40
	$iflist = get_configured_interface_list(true);
41
	foreach ($iflist as $if) {
42
		if ($config['interfaces'][$if]['if'] == $a_vxlans[$num]['vxlanif']) {
43
			return true;
44
		}
45
	}
46

    
47
	return false;
48
}
49

    
50
if ($_POST['act'] == "del") {
51
	if (!isset($_POST['id'])) {
52
		$input_errors[] = gettext("Wrong parameters supplied");
53
	} else if (empty($a_vxlans[$_POST['id']])) {
54
		$input_errors[] = gettext("Wrong index supplied");
55
	/* check if still in use */
56
	} else if (vxlan_inuse($_POST['id'])) {
57
		$input_errors[] = gettext("This VXLAN tunnel cannot be deleted because it is still being used as an interface.");
58
	} else {
59
		pfSense_interface_destroy($a_vxlans[$_POST['id']]['vxlanif']);
60
		unset($a_vxlans[$_POST['id']]);
61

    
62
		write_config("VXLAN interface deleted");
63

    
64
		header("Location: interfaces_vxlan.php");
65
		exit;
66
	}
67
}
68

    
69
$pgtitle = array(gettext("Interfaces"), gettext("VXLANs"));
70
$shortcut_section = "interfaces";
71
include("head.inc");
72
if ($input_errors) {
73
	print_input_errors($input_errors);
74
}
75

    
76
$tab_array = array();
77
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
78
$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
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
84
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
85
$tab_array[] = array(gettext("VXLANs"), true, "interfaces_vxlan.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('VXLAN 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_vxlans as $i => $vxlan):
105
	if (substr($vxlan['if'], 0, 4) == "_vip") {
106
		$if = convert_real_interface_to_friendly_descr(get_real_interface($vxlan['if']));
107
	} else {
108
		$if = $vxlan['if'];
109
	}
110
?>
111
					<tr>
112
						<td>
113
							<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($if))?>
114
						</td>
115
						<td>
116
							<?=htmlspecialchars($vxlan['remote-addr'])?>
117
						</td>
118
						<td>
119
							<?=htmlspecialchars($vxlan['descr'])?>
120
						</td>
121
						<td>
122
							<a class="fa fa-pencil"	title="<?=gettext('Edit VXLAN interface')?>"	href="interfaces_vxlan_edit.php?id=<?=$i?>"></a>
123
							<a class="fa fa-trash"	title="<?=gettext('Delete VXLAN interface')?>"	href="interfaces_vxlan.php?act=del&amp;id=<?=$i?>" usepost></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_vxlan_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");
(89-89/232)