Project

General

Profile

Download (4.28 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
 * Copyright (c) 2004-2016 Electric Sheep Fencing, LLC
7
 * 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 2af86dda Phil Davis
if (!is_array($config['laggs']['lagg'])) {
32 94be2ccf Ermal Luçi
	$config['laggs']['lagg'] = array();
33 2af86dda Phil Davis
}
34 94be2ccf Ermal Luçi
35
$a_laggs = &$config['laggs']['lagg'] ;
36
37
function lagg_inuse($num) {
38 67b6de9e Ermal Lu?i
	global $config, $a_laggs;
39 94be2ccf Ermal Luçi
40
	$iflist = get_configured_interface_list(false, true);
41
	foreach ($iflist as $if) {
42 2af86dda Phil Davis
		if ($config['interfaces'][$if]['if'] == $a_laggs[$num]['laggif']) {
43 94be2ccf Ermal Luçi
			return true;
44 2af86dda Phil Davis
		}
45 94be2ccf Ermal Luçi
	}
46
47 67b6de9e Ermal Lu?i
	if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
48 2af86dda Phil Davis
		foreach ($config['vlans']['vlan'] as $vlan) {
49
			if ($vlan['if'] == $a_laggs[$num]['laggif']) {
50 67b6de9e Ermal Lu?i
				return true;
51 fb455ab4 Sjon Hortensius
			}
52 2af86dda Phil Davis
		}
53 fb455ab4 Sjon Hortensius
	}
54 94be2ccf Ermal Luçi
	return false;
55
}
56
57
if ($_GET['act'] == "del") {
58 2af86dda Phil Davis
	if (!isset($_GET['id'])) {
59
		$input_errors[] = gettext("Wrong parameters supplied");
60
	} else if (empty($a_laggs[$_GET['id']])) {
61
		$input_errors[] = gettext("Wrong index supplied");
62 94be2ccf Ermal Luçi
	/* check if still in use */
63 2af86dda Phil Davis
	} else if (lagg_inuse($_GET['id'])) {
64 b705a25b Carlos Eduardo Ramos
		$input_errors[] = gettext("This LAGG interface cannot be deleted because it is still being used.");
65 94be2ccf Ermal Luçi
	} else {
66 67b6de9e Ermal Lu?i
		mwexec_bg("/sbin/ifconfig " . $a_laggs[$_GET['id']]['laggif'] . " destroy");
67 94be2ccf Ermal Luçi
		unset($a_laggs[$_GET['id']]);
68
69
		write_config();
70
71
		header("Location: interfaces_lagg.php");
72
		exit;
73
	}
74
}
75
76 26b4bef8 k-paulius
$pgtitle = array(gettext("Interfaces"), gettext("LAGGs"));
77 b32dd0a6 jim-p
$shortcut_section = "interfaces";
78 94be2ccf Ermal Luçi
include("head.inc");
79
80 aa82505e Phil Davis
if ($input_errors) {
81 620e28a7 sbeaver
	print_input_errors($input_errors);
82 aa82505e Phil Davis
}
83 620e28a7 sbeaver
84
$tab_array = array();
85 26b4bef8 k-paulius
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
86 fb455ab4 Sjon Hortensius
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
87
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
88
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
89
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
90
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
91 26b4bef8 k-paulius
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
92
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.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
							<a class="fa fa-pencil"	title="<?=gettext('Edit LAGG interface')?>"	href="interfaces_lagg_edit.php?id=<?=$i?>"></a>
129
							<a class="fa fa-trash"	title="<?=gettext('Delete LAGG interface')?>"	href="interfaces_lagg.php?act=del&amp;id=<?=$i?>"></a>
130
						</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
	<a href="interfaces_lagg_edit.php" class="btn btn-success btn-sm">
144
		<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");