Project

General

Profile

Download (4.35 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
 * interfaces_lagg.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-lagg
26
##|*NAME=Interfaces: LAGG:
27
##|*DESCR=Allow access to the 'Interfaces: LAGG' page.
28
##|*MATCH=interfaces_lagg.php*
29
##|-PRIV
30

    
31
require_once("guiconfig.inc");
32

    
33
init_config_arr(array('laggs', 'lagg'));
34
$a_laggs = &$config['laggs']['lagg'] ;
35

    
36
function lagg_inuse($num) {
37
	global $config, $a_laggs;
38

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

    
46
	if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
47
		foreach ($config['vlans']['vlan'] as $vlan) {
48
			if ($vlan['if'] == $a_laggs[$num]['laggif']) {
49
				return true;
50
			}
51
		}
52
	}
53
	return false;
54
}
55

    
56
if ($_POST['act'] == "del") {
57
	if (!isset($_POST['id'])) {
58
		$input_errors[] = gettext("Wrong parameters supplied");
59
	} else if (empty($a_laggs[$_POST['id']])) {
60
		$input_errors[] = gettext("Wrong index supplied");
61
	/* check if still in use */
62
	} else if (lagg_inuse($_POST['id'])) {
63
		$input_errors[] = gettext("This LAGG interface cannot be deleted because it is still being used.");
64
	} else {
65
		pfSense_interface_destroy($a_laggs[$_POST['id']]['laggif']);
66
		unset($a_laggs[$_POST['id']]);
67

    
68
		write_config("LAGG interface deleted");
69

    
70
		header("Location: interfaces_lagg.php");
71
		exit;
72
	}
73
}
74

    
75
$pgtitle = array(gettext("Interfaces"), gettext("LAGGs"));
76
$shortcut_section = "interfaces";
77
include("head.inc");
78

    
79
if ($input_errors) {
80
	print_input_errors($input_errors);
81
}
82

    
83
$tab_array = array();
84
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
85
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
86
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
87
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
88
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
89
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
90
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
91
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
92
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
93
$tab_array[] = array(gettext("LAGGs"), true, "interfaces_lagg.php");
94
display_top_tabs($tab_array);
95
?>
96
<div class="panel panel-default">
97
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('LAGG Interfaces')?></h2></div>
98
	<div class="panel-body">
99
		<div class="table-responsive">
100
			<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
101
				<thead>
102
					<tr>
103
						<th><?=gettext("Interface"); ?></th>
104
						<th><?=gettext("Members"); ?></th>
105
						<th><?=gettext("Description"); ?></th>
106
						<th><?=gettext("Actions"); ?></th>
107
					</tr>
108
				</thead>
109
				<tbody>
110
<?php
111

    
112
$i = 0;
113

    
114
foreach ($a_laggs as $lagg) {
115
?>
116
					<tr>
117
						<td>
118
							<?=htmlspecialchars(strtoupper($lagg['laggif']))?>
119
						</td>
120
						<td>
121
							<?=htmlspecialchars($lagg['members'])?>
122
						</td>
123
						<td>
124
							<?=htmlspecialchars($lagg['descr'])?>
125
						</td>
126
						<td>
127
							<a class="fa fa-pencil"	title="<?=gettext('Edit LAGG interface')?>"	href="interfaces_lagg_edit.php?id=<?=$i?>"></a>
128
							<a class="fa fa-trash"	title="<?=gettext('Delete LAGG interface')?>"	href="interfaces_lagg.php?act=del&amp;id=<?=$i?>" usepost></a>
129
						</td>
130
					</tr>
131
<?php
132
	$i++;
133
}
134
?>
135
				</tbody>
136
			</table>
137
		</div>
138
	</div>
139
</div>
140

    
141
 <nav class="action-buttons">
142
	<a href="interfaces_lagg_edit.php" class="btn btn-success btn-sm">
143
		<i class="fa fa-plus icon-embed-btn"></i>
144
		<?=gettext("Add")?>
145
	</a>
146
</nav>
147

    
148
<?php
149
include("foot.inc");
(81-81/227)