Project

General

Profile

Download (4.35 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 8f585441 Luiz Souza
 * Copyright (c) 2014-2021 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 c6c398c6 jim-p
init_config_arr(array('laggs', 'lagg'));
34 94be2ccf Ermal Luçi
$a_laggs = &$config['laggs']['lagg'] ;
35
36
function lagg_inuse($num) {
37 67b6de9e Ermal Lu?i
	global $config, $a_laggs;
38 94be2ccf Ermal Luçi
39 80fe8369 Phil Davis
	$iflist = get_configured_interface_list(true);
40 94be2ccf Ermal Luçi
	foreach ($iflist as $if) {
41 2af86dda Phil Davis
		if ($config['interfaces'][$if]['if'] == $a_laggs[$num]['laggif']) {
42 94be2ccf Ermal Luçi
			return true;
43 2af86dda Phil Davis
		}
44 94be2ccf Ermal Luçi
	}
45
46 67b6de9e Ermal Lu?i
	if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
47 2af86dda Phil Davis
		foreach ($config['vlans']['vlan'] as $vlan) {
48
			if ($vlan['if'] == $a_laggs[$num]['laggif']) {
49 67b6de9e Ermal Lu?i
				return true;
50 fb455ab4 Sjon Hortensius
			}
51 2af86dda Phil Davis
		}
52 fb455ab4 Sjon Hortensius
	}
53 94be2ccf Ermal Luçi
	return false;
54
}
55
56 41063bd7 Steve Beaver
if ($_POST['act'] == "del") {
57
	if (!isset($_POST['id'])) {
58 2af86dda Phil Davis
		$input_errors[] = gettext("Wrong parameters supplied");
59 41063bd7 Steve Beaver
	} else if (empty($a_laggs[$_POST['id']])) {
60 2af86dda Phil Davis
		$input_errors[] = gettext("Wrong index supplied");
61 94be2ccf Ermal Luçi
	/* check if still in use */
62 41063bd7 Steve Beaver
	} else if (lagg_inuse($_POST['id'])) {
63 b705a25b Carlos Eduardo Ramos
		$input_errors[] = gettext("This LAGG interface cannot be deleted because it is still being used.");
64 94be2ccf Ermal Luçi
	} else {
65 41063bd7 Steve Beaver
		pfSense_interface_destroy($a_laggs[$_POST['id']]['laggif']);
66
		unset($a_laggs[$_POST['id']]);
67 94be2ccf Ermal Luçi
68 e85ae672 Renato Botelho do Couto
		write_config("LAGG interface deleted");
69 94be2ccf Ermal Luçi
70
		header("Location: interfaces_lagg.php");
71
		exit;
72
	}
73
}
74
75 26b4bef8 k-paulius
$pgtitle = array(gettext("Interfaces"), gettext("LAGGs"));
76 b32dd0a6 jim-p
$shortcut_section = "interfaces";
77 94be2ccf Ermal Luçi
include("head.inc");
78
79 aa82505e Phil Davis
if ($input_errors) {
80 620e28a7 sbeaver
	print_input_errors($input_errors);
81 aa82505e Phil Davis
}
82 620e28a7 sbeaver
83
$tab_array = array();
84 26b4bef8 k-paulius
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
85 fb455ab4 Sjon Hortensius
$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 26b4bef8 k-paulius
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
91
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
92 fb455ab4 Sjon Hortensius
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
93 26b4bef8 k-paulius
$tab_array[] = array(gettext("LAGGs"), true, "interfaces_lagg.php");
94 620e28a7 sbeaver
display_top_tabs($tab_array);
95 94be2ccf Ermal Luçi
?>
96 060ed238 Stephen Beaver
<div class="panel panel-default">
97 70dc5cd6 Phil Davis
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('LAGG Interfaces')?></h2></div>
98 060ed238 Stephen Beaver
	<div class="panel-body">
99
		<div class="table-responsive">
100 1c10ce97 PiBa-NL
			<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
101 060ed238 Stephen Beaver
				<thead>
102
					<tr>
103 70dc5cd6 Phil Davis
						<th><?=gettext("Interface"); ?></th>
104
						<th><?=gettext("Members"); ?></th>
105
						<th><?=gettext("Description"); ?></th>
106
						<th><?=gettext("Actions"); ?></th>
107 060ed238 Stephen Beaver
					</tr>
108
				</thead>
109
				<tbody>
110 620e28a7 sbeaver
<?php
111
112
$i = 0;
113 94be2ccf Ermal Luçi
114 620e28a7 sbeaver
foreach ($a_laggs as $lagg) {
115
?>
116 060ed238 Stephen Beaver
					<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 4401107f Steve Beaver
							<a class="fa fa-pencil"	title="<?=gettext('Edit LAGG interface')?>"	href="interfaces_lagg_edit.php?id=<?=$i?>"></a>
128 41063bd7 Steve Beaver
							<a class="fa fa-trash"	title="<?=gettext('Delete LAGG interface')?>"	href="interfaces_lagg.php?act=del&amp;id=<?=$i?>" usepost></a>
129 060ed238 Stephen Beaver
						</td>
130
					</tr>
131 94be2ccf Ermal Luçi
<?php
132 620e28a7 sbeaver
	$i++;
133
}
134 94be2ccf Ermal Luçi
?>
135 060ed238 Stephen Beaver
				</tbody>
136
			</table>
137
		</div>
138
	</div>
139 620e28a7 sbeaver
</div>
140 060ed238 Stephen Beaver
141
 <nav class="action-buttons">
142 4401107f Steve Beaver
	<a href="interfaces_lagg_edit.php" class="btn btn-success btn-sm">
143 060ed238 Stephen Beaver
		<i class="fa fa-plus icon-embed-btn"></i>
144
		<?=gettext("Add")?>
145
	</a>
146
</nav>
147
148 620e28a7 sbeaver
<?php
149
include("foot.inc");