Project

General

Profile

Download (4.4 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 0284d79e jim-p
 * Copyright (c) 2014-2020 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
		write_config();
69
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 b6ea9c61 Viktor G
$tab_array[] = array(gettext("VXLANs"), false, "interfaces_vxlan.php");
93 fb455ab4 Sjon Hortensius
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
94 26b4bef8 k-paulius
$tab_array[] = array(gettext("LAGGs"), true, "interfaces_lagg.php");
95 620e28a7 sbeaver
display_top_tabs($tab_array);
96 94be2ccf Ermal Luçi
?>
97 060ed238 Stephen Beaver
<div class="panel panel-default">
98 70dc5cd6 Phil Davis
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('LAGG Interfaces')?></h2></div>
99 060ed238 Stephen Beaver
	<div class="panel-body">
100
		<div class="table-responsive">
101 1c10ce97 PiBa-NL
			<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
102 060ed238 Stephen Beaver
				<thead>
103
					<tr>
104 70dc5cd6 Phil Davis
						<th><?=gettext("Interface"); ?></th>
105
						<th><?=gettext("Members"); ?></th>
106
						<th><?=gettext("Description"); ?></th>
107
						<th><?=gettext("Actions"); ?></th>
108 060ed238 Stephen Beaver
					</tr>
109
				</thead>
110
				<tbody>
111 620e28a7 sbeaver
<?php
112
113
$i = 0;
114 94be2ccf Ermal Luçi
115 620e28a7 sbeaver
foreach ($a_laggs as $lagg) {
116
?>
117 060ed238 Stephen Beaver
					<tr>
118
						<td>
119
							<?=htmlspecialchars(strtoupper($lagg['laggif']))?>
120
						</td>
121
						<td>
122
							<?=htmlspecialchars($lagg['members'])?>
123
						</td>
124
						<td>
125
							<?=htmlspecialchars($lagg['descr'])?>
126
						</td>
127
						<td>
128 4401107f Steve Beaver
							<a class="fa fa-pencil"	title="<?=gettext('Edit LAGG interface')?>"	href="interfaces_lagg_edit.php?id=<?=$i?>"></a>
129 41063bd7 Steve Beaver
							<a class="fa fa-trash"	title="<?=gettext('Delete LAGG interface')?>"	href="interfaces_lagg.php?act=del&amp;id=<?=$i?>" usepost></a>
130 060ed238 Stephen Beaver
						</td>
131
					</tr>
132 94be2ccf Ermal Luçi
<?php
133 620e28a7 sbeaver
	$i++;
134
}
135 94be2ccf Ermal Luçi
?>
136 060ed238 Stephen Beaver
				</tbody>
137
			</table>
138
		</div>
139
	</div>
140 620e28a7 sbeaver
</div>
141 060ed238 Stephen Beaver
142
 <nav class="action-buttons">
143 4401107f Steve Beaver
	<a href="interfaces_lagg_edit.php" class="btn btn-success btn-sm">
144 060ed238 Stephen Beaver
		<i class="fa fa-plus icon-embed-btn"></i>
145
		<?=gettext("Add")?>
146
	</a>
147
</nav>
148
149 620e28a7 sbeaver
<?php
150
include("foot.inc");