Project

General

Profile

Download (4.34 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 b8f91b7c Luiz Souza
 * Copyright (c) 2004-2018 Rubicon Communications, LLC (Netgate)
7 c5d81585 Renato Botelho
 * All rights reserved.
8 b9043cdc Stephen Beaver
 *
9 b12ea3fb Renato Botelho
 * Licensed under the Apache License, Version 2.0 (the "License");
10
 * you may not use this file except in compliance with the License.
11
 * You may obtain a copy of the License at
12 b9043cdc Stephen Beaver
 *
13 b12ea3fb Renato Botelho
 * http://www.apache.org/licenses/LICENSE-2.0
14 b9043cdc Stephen Beaver
 *
15 b12ea3fb Renato Botelho
 * Unless required by applicable law or agreed to in writing, software
16
 * distributed under the License is distributed on an "AS IS" BASIS,
17
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
 * See the License for the specific language governing permissions and
19
 * limitations under the License.
20 b9043cdc Stephen Beaver
 */
21 7ac5a4cb Scott Ullrich
22
##|+PRIV
23 7997ed44 Renato Botelho
##|*IDENT=page-interfaces-lagg
24 5230f468 jim-p
##|*NAME=Interfaces: LAGG:
25 7997ed44 Renato Botelho
##|*DESCR=Allow access to the 'Interfaces: LAGG' page.
26 7ac5a4cb Scott Ullrich
##|*MATCH=interfaces_lagg.php*
27
##|-PRIV
28 94be2ccf Ermal Luçi
29 c81ef6e2 Phil Davis
require_once("guiconfig.inc");
30 94be2ccf Ermal Luçi
31 2b3b5975 Steve Beaver
if (!is_array($config['laggs'])) {
32
	$config['laggs'] = array();
33
}
34
35 2af86dda Phil Davis
if (!is_array($config['laggs']['lagg'])) {
36 94be2ccf Ermal Luçi
	$config['laggs']['lagg'] = array();
37 2af86dda Phil Davis
}
38 94be2ccf Ermal Luçi
39
$a_laggs = &$config['laggs']['lagg'] ;
40
41
function lagg_inuse($num) {
42 67b6de9e Ermal Lu?i
	global $config, $a_laggs;
43 94be2ccf Ermal Luçi
44 80fe8369 Phil Davis
	$iflist = get_configured_interface_list(true);
45 94be2ccf Ermal Luçi
	foreach ($iflist as $if) {
46 2af86dda Phil Davis
		if ($config['interfaces'][$if]['if'] == $a_laggs[$num]['laggif']) {
47 94be2ccf Ermal Luçi
			return true;
48 2af86dda Phil Davis
		}
49 94be2ccf Ermal Luçi
	}
50
51 67b6de9e Ermal Lu?i
	if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
52 2af86dda Phil Davis
		foreach ($config['vlans']['vlan'] as $vlan) {
53
			if ($vlan['if'] == $a_laggs[$num]['laggif']) {
54 67b6de9e Ermal Lu?i
				return true;
55 fb455ab4 Sjon Hortensius
			}
56 2af86dda Phil Davis
		}
57 fb455ab4 Sjon Hortensius
	}
58 94be2ccf Ermal Luçi
	return false;
59
}
60
61 41063bd7 Steve Beaver
if ($_POST['act'] == "del") {
62
	if (!isset($_POST['id'])) {
63 2af86dda Phil Davis
		$input_errors[] = gettext("Wrong parameters supplied");
64 41063bd7 Steve Beaver
	} else if (empty($a_laggs[$_POST['id']])) {
65 2af86dda Phil Davis
		$input_errors[] = gettext("Wrong index supplied");
66 94be2ccf Ermal Luçi
	/* check if still in use */
67 41063bd7 Steve Beaver
	} else if (lagg_inuse($_POST['id'])) {
68 b705a25b Carlos Eduardo Ramos
		$input_errors[] = gettext("This LAGG interface cannot be deleted because it is still being used.");
69 94be2ccf Ermal Luçi
	} else {
70 41063bd7 Steve Beaver
		pfSense_interface_destroy($a_laggs[$_POST['id']]['laggif']);
71
		unset($a_laggs[$_POST['id']]);
72 94be2ccf Ermal Luçi
73
		write_config();
74
75
		header("Location: interfaces_lagg.php");
76
		exit;
77
	}
78
}
79
80 26b4bef8 k-paulius
$pgtitle = array(gettext("Interfaces"), gettext("LAGGs"));
81 b32dd0a6 jim-p
$shortcut_section = "interfaces";
82 94be2ccf Ermal Luçi
include("head.inc");
83
84 aa82505e Phil Davis
if ($input_errors) {
85 620e28a7 sbeaver
	print_input_errors($input_errors);
86 aa82505e Phil Davis
}
87 620e28a7 sbeaver
88
$tab_array = array();
89 26b4bef8 k-paulius
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
90 fb455ab4 Sjon Hortensius
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
91
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
92
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
93
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
94
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
95 26b4bef8 k-paulius
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
96
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
97 fb455ab4 Sjon Hortensius
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
98 26b4bef8 k-paulius
$tab_array[] = array(gettext("LAGGs"), true, "interfaces_lagg.php");
99 620e28a7 sbeaver
display_top_tabs($tab_array);
100 94be2ccf Ermal Luçi
?>
101 060ed238 Stephen Beaver
<div class="panel panel-default">
102 70dc5cd6 Phil Davis
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('LAGG Interfaces')?></h2></div>
103 060ed238 Stephen Beaver
	<div class="panel-body">
104
		<div class="table-responsive">
105 1c10ce97 PiBa-NL
			<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
106 060ed238 Stephen Beaver
				<thead>
107
					<tr>
108 70dc5cd6 Phil Davis
						<th><?=gettext("Interface"); ?></th>
109
						<th><?=gettext("Members"); ?></th>
110
						<th><?=gettext("Description"); ?></th>
111
						<th><?=gettext("Actions"); ?></th>
112 060ed238 Stephen Beaver
					</tr>
113
				</thead>
114
				<tbody>
115 620e28a7 sbeaver
<?php
116
117
$i = 0;
118 94be2ccf Ermal Luçi
119 620e28a7 sbeaver
foreach ($a_laggs as $lagg) {
120
?>
121 060ed238 Stephen Beaver
					<tr>
122
						<td>
123
							<?=htmlspecialchars(strtoupper($lagg['laggif']))?>
124
						</td>
125
						<td>
126
							<?=htmlspecialchars($lagg['members'])?>
127
						</td>
128
						<td>
129
							<?=htmlspecialchars($lagg['descr'])?>
130
						</td>
131
						<td>
132 4401107f Steve Beaver
							<a class="fa fa-pencil"	title="<?=gettext('Edit LAGG interface')?>"	href="interfaces_lagg_edit.php?id=<?=$i?>"></a>
133 41063bd7 Steve Beaver
							<a class="fa fa-trash"	title="<?=gettext('Delete LAGG interface')?>"	href="interfaces_lagg.php?act=del&amp;id=<?=$i?>" usepost></a>
134 060ed238 Stephen Beaver
						</td>
135
					</tr>
136 94be2ccf Ermal Luçi
<?php
137 620e28a7 sbeaver
	$i++;
138
}
139 94be2ccf Ermal Luçi
?>
140 060ed238 Stephen Beaver
				</tbody>
141
			</table>
142
		</div>
143
	</div>
144 620e28a7 sbeaver
</div>
145 060ed238 Stephen Beaver
146
 <nav class="action-buttons">
147 4401107f Steve Beaver
	<a href="interfaces_lagg_edit.php" class="btn btn-success btn-sm">
148 060ed238 Stephen Beaver
		<i class="fa fa-plus icon-embed-btn"></i>
149
		<?=gettext("Add")?>
150
	</a>
151
</nav>
152
153 620e28a7 sbeaver
<?php
154
include("foot.inc");