Project

General

Profile

Download (4.38 KB) Statistics
| Branch: | Tag: | Revision:
1 94be2ccf Ermal Luçi
<?php
2
/*
3 c5d81585 Renato Botelho
 * interfaces_lagg.php
4 b9043cdc Stephen Beaver
 *
5 c5d81585 Renato Botelho
 * part of pfSense (https://www.pfsense.org)
6 38809d47 Renato Botelho do Couto
 * Copyright (c) 2004-2013 BSD Perimeter
7
 * Copyright (c) 2013-2016 Electric Sheep Fencing
8 a68f7a3d Luiz Otavio O Souza
 * Copyright (c) 2014-2024 Rubicon Communications, LLC (Netgate)
9 c5d81585 Renato Botelho
 * All rights reserved.
10 b9043cdc Stephen Beaver
 *
11 b12ea3fb Renato Botelho
 * 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 b9043cdc Stephen Beaver
 *
15 b12ea3fb Renato Botelho
 * http://www.apache.org/licenses/LICENSE-2.0
16 b9043cdc Stephen Beaver
 *
17 b12ea3fb Renato Botelho
 * 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 b9043cdc Stephen Beaver
 */
23 7ac5a4cb Scott Ullrich
24
##|+PRIV
25 7997ed44 Renato Botelho
##|*IDENT=page-interfaces-lagg
26 5230f468 jim-p
##|*NAME=Interfaces: LAGG:
27 7997ed44 Renato Botelho
##|*DESCR=Allow access to the 'Interfaces: LAGG' page.
28 7ac5a4cb Scott Ullrich
##|*MATCH=interfaces_lagg.php*
29
##|-PRIV
30 94be2ccf Ermal Luçi
31 c81ef6e2 Phil Davis
require_once("guiconfig.inc");
32 94be2ccf Ermal Luçi
33 63d6bb4f Marcos Mendoza
config_init_path('laggs/lagg');
34 94be2ccf Ermal Luçi
35
function lagg_inuse($num) {
36 63d6bb4f Marcos Mendoza
	$a_laggs = config_get_path('laggs/lagg');
37
	$if_config = config_get_path('interfaces');
38 80fe8369 Phil Davis
	$iflist = get_configured_interface_list(true);
39 94be2ccf Ermal Luçi
	foreach ($iflist as $if) {
40 63d6bb4f Marcos Mendoza
		if ($if_config[$if]['if'] == $a_laggs[$num]['laggif']) {
41 94be2ccf Ermal Luçi
			return true;
42 2af86dda Phil Davis
		}
43 94be2ccf Ermal Luçi
	}
44
45 960388e0 jim-p
	foreach (config_get_path('vlans/vlan', []) as $vlan) {
46
		if ($vlan['if'] == $a_laggs[$num]['laggif']) {
47
			return true;
48 2af86dda Phil Davis
		}
49 fb455ab4 Sjon Hortensius
	}
50 94be2ccf Ermal Luçi
	return false;
51
}
52
53 41063bd7 Steve Beaver
if ($_POST['act'] == "del") {
54
	if (!isset($_POST['id'])) {
55 2af86dda Phil Davis
		$input_errors[] = gettext("Wrong parameters supplied");
56 63d6bb4f Marcos Mendoza
	} else if (empty(config_get_path("laggs/lagg/{$_POST['id']}"))) {
57 2af86dda Phil Davis
		$input_errors[] = gettext("Wrong index supplied");
58 94be2ccf Ermal Luçi
	/* check if still in use */
59 41063bd7 Steve Beaver
	} else if (lagg_inuse($_POST['id'])) {
60 b705a25b Carlos Eduardo Ramos
		$input_errors[] = gettext("This LAGG interface cannot be deleted because it is still being used.");
61 94be2ccf Ermal Luçi
	} else {
62 63d6bb4f Marcos Mendoza
		pfSense_interface_destroy(config_get_path("laggs/lagg/{$_POST['id']}/laggif"));
63
		config_del_path("laggs/lagg/{$_POST['id']}");
64 94be2ccf Ermal Luçi
65 e85ae672 Renato Botelho do Couto
		write_config("LAGG interface deleted");
66 94be2ccf Ermal Luçi
67
		header("Location: interfaces_lagg.php");
68
		exit;
69
	}
70
}
71
72 26b4bef8 k-paulius
$pgtitle = array(gettext("Interfaces"), gettext("LAGGs"));
73 b32dd0a6 jim-p
$shortcut_section = "interfaces";
74 94be2ccf Ermal Luçi
include("head.inc");
75
76 aa82505e Phil Davis
if ($input_errors) {
77 620e28a7 sbeaver
	print_input_errors($input_errors);
78 aa82505e Phil Davis
}
79 620e28a7 sbeaver
80
$tab_array = array();
81 26b4bef8 k-paulius
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
82 fb455ab4 Sjon Hortensius
$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 26b4bef8 k-paulius
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
88
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
89 fb455ab4 Sjon Hortensius
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
90 26b4bef8 k-paulius
$tab_array[] = array(gettext("LAGGs"), true, "interfaces_lagg.php");
91 620e28a7 sbeaver
display_top_tabs($tab_array);
92 94be2ccf Ermal Luçi
?>
93 060ed238 Stephen Beaver
<div class="panel panel-default">
94 70dc5cd6 Phil Davis
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('LAGG Interfaces')?></h2></div>
95 060ed238 Stephen Beaver
	<div class="panel-body">
96
		<div class="table-responsive">
97 1c10ce97 PiBa-NL
			<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
98 060ed238 Stephen Beaver
				<thead>
99
					<tr>
100 70dc5cd6 Phil Davis
						<th><?=gettext("Interface"); ?></th>
101
						<th><?=gettext("Members"); ?></th>
102
						<th><?=gettext("Description"); ?></th>
103
						<th><?=gettext("Actions"); ?></th>
104 060ed238 Stephen Beaver
					</tr>
105
				</thead>
106
				<tbody>
107 620e28a7 sbeaver
<?php
108
109
$i = 0;
110 94be2ccf Ermal Luçi
111 4b9165e5 Marcos Mendoza
foreach (config_get_path('laggs/lagg', []) as $lagg) {
112 620e28a7 sbeaver
?>
113 060ed238 Stephen Beaver
					<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 e0cb987c Marcos Mendoza
							<a class="fa-solid fa-pencil"	title="<?=gettext('Edit LAGG interface')?>"	href="interfaces_lagg_edit.php?id=<?=$i?>"></a>
125 c1d304b3 Marcos Mendoza
							<a class="fa-solid fa-trash-can"	title="<?=gettext('Delete LAGG interface')?>"	href="interfaces_lagg.php?act=del&amp;id=<?=$i?>" usepost></a>
126 060ed238 Stephen Beaver
						</td>
127
					</tr>
128 94be2ccf Ermal Luçi
<?php
129 620e28a7 sbeaver
	$i++;
130
}
131 94be2ccf Ermal Luçi
?>
132 060ed238 Stephen Beaver
				</tbody>
133
			</table>
134
		</div>
135
	</div>
136 620e28a7 sbeaver
</div>
137 060ed238 Stephen Beaver
138
 <nav class="action-buttons">
139 4401107f Steve Beaver
	<a href="interfaces_lagg_edit.php" class="btn btn-success btn-sm">
140 e0cb987c Marcos Mendoza
		<i class="fa-solid fa-plus icon-embed-btn"></i>
141 060ed238 Stephen Beaver
		<?=gettext("Add")?>
142
	</a>
143
</nav>
144
145 620e28a7 sbeaver
<?php
146
include("foot.inc");