Project

General

Profile

Download (4.3 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-2024 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
	foreach (config_get_path('vlans/vlan', []) as $vlan) {
47
		if ($vlan['if'] == $a_laggs[$num]['laggif']) {
48
			return true;
49
		}
50
	}
51
	return false;
52
}
53

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

    
66
		write_config("LAGG interface deleted");
67

    
68
		header("Location: interfaces_lagg.php");
69
		exit;
70
	}
71
}
72

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

    
77
if ($input_errors) {
78
	print_input_errors($input_errors);
79
}
80

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

    
110
$i = 0;
111

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

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

    
146
<?php
147
include("foot.inc");
(81-81/228)