Project

General

Profile

Download (4.34 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-2018 Rubicon Communications, LLC (Netgate)
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'])) {
32
	$config['laggs'] = array();
33
}
34

    
35
if (!is_array($config['laggs']['lagg'])) {
36
	$config['laggs']['lagg'] = array();
37
}
38

    
39
$a_laggs = &$config['laggs']['lagg'] ;
40

    
41
function lagg_inuse($num) {
42
	global $config, $a_laggs;
43

    
44
	$iflist = get_configured_interface_list(true);
45
	foreach ($iflist as $if) {
46
		if ($config['interfaces'][$if]['if'] == $a_laggs[$num]['laggif']) {
47
			return true;
48
		}
49
	}
50

    
51
	if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
52
		foreach ($config['vlans']['vlan'] as $vlan) {
53
			if ($vlan['if'] == $a_laggs[$num]['laggif']) {
54
				return true;
55
			}
56
		}
57
	}
58
	return false;
59
}
60

    
61
if ($_POST['act'] == "del") {
62
	if (!isset($_POST['id'])) {
63
		$input_errors[] = gettext("Wrong parameters supplied");
64
	} else if (empty($a_laggs[$_POST['id']])) {
65
		$input_errors[] = gettext("Wrong index supplied");
66
	/* check if still in use */
67
	} else if (lagg_inuse($_POST['id'])) {
68
		$input_errors[] = gettext("This LAGG interface cannot be deleted because it is still being used.");
69
	} else {
70
		pfSense_interface_destroy($a_laggs[$_POST['id']]['laggif']);
71
		unset($a_laggs[$_POST['id']]);
72

    
73
		write_config();
74

    
75
		header("Location: interfaces_lagg.php");
76
		exit;
77
	}
78
}
79

    
80
$pgtitle = array(gettext("Interfaces"), gettext("LAGGs"));
81
$shortcut_section = "interfaces";
82
include("head.inc");
83

    
84
if ($input_errors) {
85
	print_input_errors($input_errors);
86
}
87

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

    
117
$i = 0;
118

    
119
foreach ($a_laggs as $lagg) {
120
?>
121
					<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
							<a class="fa fa-pencil"	title="<?=gettext('Edit LAGG interface')?>"	href="interfaces_lagg_edit.php?id=<?=$i?>"></a>
133
							<a class="fa fa-trash"	title="<?=gettext('Delete LAGG interface')?>"	href="interfaces_lagg.php?act=del&amp;id=<?=$i?>" usepost></a>
134
						</td>
135
					</tr>
136
<?php
137
	$i++;
138
}
139
?>
140
				</tbody>
141
			</table>
142
		</div>
143
	</div>
144
</div>
145

    
146
 <nav class="action-buttons">
147
	<a href="interfaces_lagg_edit.php" class="btn btn-success btn-sm">
148
		<i class="fa fa-plus icon-embed-btn"></i>
149
		<?=gettext("Add")?>
150
	</a>
151
</nav>
152

    
153
<?php
154
include("foot.inc");
(81-81/234)