Project

General

Profile

Download (4.28 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
 * interfaces_lagg.php
4
 *
5
 * part of pfSense (https://www.pfsense.org)
6
 * Copyright (c) 2004-2016 Electric Sheep Fencing, LLC
7
 * All rights reserved.
8
 *
9
 * 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
 *
13
 * http://www.apache.org/licenses/LICENSE-2.0
14
 *
15
 * 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
 */
21

    
22
##|+PRIV
23
##|*IDENT=page-interfaces-lagg
24
##|*NAME=Interfaces: LAGG:
25
##|*DESCR=Allow access to the 'Interfaces: LAGG' page.
26
##|*MATCH=interfaces_lagg.php*
27
##|-PRIV
28

    
29
require_once("guiconfig.inc");
30

    
31
if (!is_array($config['laggs']['lagg'])) {
32
	$config['laggs']['lagg'] = array();
33
}
34

    
35
$a_laggs = &$config['laggs']['lagg'] ;
36

    
37
function lagg_inuse($num) {
38
	global $config, $a_laggs;
39

    
40
	$iflist = get_configured_interface_list(false, true);
41
	foreach ($iflist as $if) {
42
		if ($config['interfaces'][$if]['if'] == $a_laggs[$num]['laggif']) {
43
			return true;
44
		}
45
	}
46

    
47
	if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
48
		foreach ($config['vlans']['vlan'] as $vlan) {
49
			if ($vlan['if'] == $a_laggs[$num]['laggif']) {
50
				return true;
51
			}
52
		}
53
	}
54
	return false;
55
}
56

    
57
if ($_GET['act'] == "del") {
58
	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
	/* check if still in use */
63
	} else if (lagg_inuse($_GET['id'])) {
64
		$input_errors[] = gettext("This LAGG interface cannot be deleted because it is still being used.");
65
	} else {
66
		mwexec_bg("/sbin/ifconfig " . $a_laggs[$_GET['id']]['laggif'] . " destroy");
67
		unset($a_laggs[$_GET['id']]);
68

    
69
		write_config();
70

    
71
		header("Location: interfaces_lagg.php");
72
		exit;
73
	}
74
}
75

    
76
$pgtitle = array(gettext("Interfaces"), gettext("LAGGs"));
77
$shortcut_section = "interfaces";
78
include("head.inc");
79

    
80
if ($input_errors) {
81
	print_input_errors($input_errors);
82
}
83

    
84
$tab_array = array();
85
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
86
$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
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
92
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
93
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
94
$tab_array[] = array(gettext("LAGGs"), true, "interfaces_lagg.php");
95
display_top_tabs($tab_array);
96
?>
97
<div class="panel panel-default">
98
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('LAGG Interfaces')?></h2></div>
99
	<div class="panel-body">
100
		<div class="table-responsive">
101
			<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
102
				<thead>
103
					<tr>
104
						<th><?=gettext("Interface"); ?></th>
105
						<th><?=gettext("Members"); ?></th>
106
						<th><?=gettext("Description"); ?></th>
107
						<th><?=gettext("Actions"); ?></th>
108
					</tr>
109
				</thead>
110
				<tbody>
111
<?php
112

    
113
$i = 0;
114

    
115
foreach ($a_laggs as $lagg) {
116
?>
117
					<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
<?php
133
	$i++;
134
}
135
?>
136
				</tbody>
137
			</table>
138
		</div>
139
	</div>
140
</div>
141

    
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
<?php
150
include("foot.inc");
(78-78/227)