Project

General

Profile

Download (4.38 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
config_init_path('laggs/lagg');
34

    
35
function lagg_inuse($num) {
36
	$a_laggs = config_get_path('laggs/lagg');
37
	$if_config = config_get_path('interfaces');
38
	$iflist = get_configured_interface_list(true);
39
	foreach ($iflist as $if) {
40
		if ($if_config[$if]['if'] == $a_laggs[$num]['laggif']) {
41
			return true;
42
		}
43
	}
44

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

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

    
65
		write_config("LAGG interface deleted");
66

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

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

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

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

    
109
$i = 0;
110

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

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

    
145
<?php
146
include("foot.inc");
(83-83/232)