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-2025 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
function lagg_inuse($num) {
34
	$a_laggs = config_get_path('laggs/lagg', []);
35
	$if_config = config_get_path('interfaces', []);
36
	$iflist = get_configured_interface_list(true);
37
	foreach ($iflist as $if) {
38
		if ($if_config[$if]['if'] == $a_laggs[$num]['laggif']) {
39
			return true;
40
		}
41
	}
42

    
43
	foreach (config_get_path('vlans/vlan', []) as $vlan) {
44
		if ($vlan['if'] == $a_laggs[$num]['laggif']) {
45
			return true;
46
		}
47
	}
48
	return false;
49
}
50

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

    
63
		write_config("LAGG interface deleted");
64

    
65
		header("Location: interfaces_lagg.php");
66
		exit;
67
	}
68
}
69

    
70
$pgtitle = array(gettext("Interfaces"), gettext("LAGGs"));
71
$shortcut_section = "interfaces";
72
include("head.inc");
73

    
74
if ($input_errors) {
75
	print_input_errors($input_errors);
76
}
77

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

    
107
$i = 0;
108

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

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

    
143
<?php
144
include("foot.inc");
(83-83/233)