Project

General

Profile

Download (4.62 KB) Statistics
| Branch: | Tag: | Revision:
1 94be2ccf Ermal Luçi
<?php
2
/* $Id$ */
3
/*
4
	interfaces_lagg.php
5
6 ce77a9c4 Phil Davis
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
7 1d7ba683 ayvis
	Copyright (C) 2008 Ermal Luçi
8 94be2ccf Ermal Luçi
	All rights reserved.
9
10
	Redistribution and use in source and binary forms, with or without
11
	modification, are permitted provided that the following conditions are met:
12
13
	1. Redistributions of source code must retain the above copyright notice,
14
	   this list of conditions and the following disclaimer.
15
16
	2. Redistributions in binary form must reproduce the above copyright
17
	   notice, this list of conditions and the following disclaimer in the
18
	   documentation and/or other materials provided with the distribution.
19
20
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
24
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
	POSSIBILITY OF SUCH DAMAGE.
30
*/
31 7ac5a4cb Scott Ullrich
/*
32
	pfSense_BUILDER_BINARIES:	/sbin/ifconfig
33 620e28a7 sbeaver
	pfSense_MODULE: interfaces
34 7ac5a4cb Scott Ullrich
*/
35
36
##|+PRIV
37 7997ed44 Renato Botelho
##|*IDENT=page-interfaces-lagg
38 7ac5a4cb Scott Ullrich
##|*NAME=Interfaces: LAGG: page
39 7997ed44 Renato Botelho
##|*DESCR=Allow access to the 'Interfaces: LAGG' page.
40 7ac5a4cb Scott Ullrich
##|*MATCH=interfaces_lagg.php*
41
##|-PRIV
42 94be2ccf Ermal Luçi
43
require("guiconfig.inc");
44
45 2af86dda Phil Davis
if (!is_array($config['laggs']['lagg'])) {
46 94be2ccf Ermal Luçi
	$config['laggs']['lagg'] = array();
47 2af86dda Phil Davis
}
48 94be2ccf Ermal Luçi
49
$a_laggs = &$config['laggs']['lagg'] ;
50
51
function lagg_inuse($num) {
52 67b6de9e Ermal Lu?i
	global $config, $a_laggs;
53 94be2ccf Ermal Luçi
54
	$iflist = get_configured_interface_list(false, true);
55
	foreach ($iflist as $if) {
56 2af86dda Phil Davis
		if ($config['interfaces'][$if]['if'] == $a_laggs[$num]['laggif']) {
57 94be2ccf Ermal Luçi
			return true;
58 2af86dda Phil Davis
		}
59 94be2ccf Ermal Luçi
	}
60
61 67b6de9e Ermal Lu?i
	if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
62 2af86dda Phil Davis
		foreach ($config['vlans']['vlan'] as $vlan) {
63
			if ($vlan['if'] == $a_laggs[$num]['laggif']) {
64 67b6de9e Ermal Lu?i
				return true;
65 fb455ab4 Sjon Hortensius
			}
66 2af86dda Phil Davis
		}
67 fb455ab4 Sjon Hortensius
	}
68 94be2ccf Ermal Luçi
	return false;
69
}
70
71
if ($_GET['act'] == "del") {
72 2af86dda Phil Davis
	if (!isset($_GET['id'])) {
73
		$input_errors[] = gettext("Wrong parameters supplied");
74
	} else if (empty($a_laggs[$_GET['id']])) {
75
		$input_errors[] = gettext("Wrong index supplied");
76 94be2ccf Ermal Luçi
	/* check if still in use */
77 2af86dda Phil Davis
	} else if (lagg_inuse($_GET['id'])) {
78 b705a25b Carlos Eduardo Ramos
		$input_errors[] = gettext("This LAGG interface cannot be deleted because it is still being used.");
79 94be2ccf Ermal Luçi
	} else {
80 67b6de9e Ermal Lu?i
		mwexec_bg("/sbin/ifconfig " . $a_laggs[$_GET['id']]['laggif'] . " destroy");
81 94be2ccf Ermal Luçi
		unset($a_laggs[$_GET['id']]);
82
83
		write_config();
84
85
		header("Location: interfaces_lagg.php");
86
		exit;
87
	}
88
}
89
90 6c07db48 Phil Davis
$pgtitle = array(gettext("Interfaces"), gettext("LAGG"));
91 b32dd0a6 jim-p
$shortcut_section = "interfaces";
92 94be2ccf Ermal Luçi
include("head.inc");
93
94 620e28a7 sbeaver
if ($input_errors)
95
	print_input_errors($input_errors);
96
97
$tab_array = array();
98 fb455ab4 Sjon Hortensius
$tab_array[] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
99
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
100
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
101
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
102
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
103
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
104
$tab_array[] = array(gettext("GRE"), false, "interfaces_gre.php");
105
$tab_array[] = array(gettext("GIF"), false, "interfaces_gif.php");
106
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
107
$tab_array[] = array(gettext("LAGG"), true, "interfaces_lagg.php");
108 620e28a7 sbeaver
display_top_tabs($tab_array);
109 94be2ccf Ermal Luçi
?>
110 620e28a7 sbeaver
<div class="table-responsive">
111
	<table class="table table-striped table-hover table-condensed">
112
		<thead>
113
			<tr>
114
			  <th><?=gettext("Interface"); ?></th>
115
			  <th><?=gettext("Members"); ?></th>
116
			  <th><?=gettext("Description"); ?></th>
117
			  <th></th>
118
			</tr>
119
		</thead>
120
		<tbody>
121
<?php
122
123
$i = 0;
124 94be2ccf Ermal Luçi
125 620e28a7 sbeaver
foreach ($a_laggs as $lagg) {
126
?>
127 fb455ab4 Sjon Hortensius
			<tr>
128 620e28a7 sbeaver
				<td>
129
					<?=htmlspecialchars(strtoupper($lagg['laggif']))?>
130
				</td>
131
				<td>
132
					<?=htmlspecialchars($lagg['members'])?>
133
				</td>
134
				<td>
135
					<?=htmlspecialchars($lagg['descr'])?>
136
				</td>
137
				<td>
138
					<a href="interfaces_lagg_edit.php?id=<?=$i?>" class="btn btn-default btn-xs"><?=gettext("Edit")?></a>
139
					<a href="interfaces_lagg.php?act=del&amp;id=<?=$i?>" class="btn btn-danger btn-xs"><?=gettext("Delete")?></a>
140
				</td>
141
			</tr>
142 94be2ccf Ermal Luçi
<?php
143 620e28a7 sbeaver
	$i++;
144
}
145 94be2ccf Ermal Luçi
?>
146 620e28a7 sbeaver
		</tbody>
147
	</table>
148 fb455ab4 Sjon Hortensius
149
	 <nav class="action-buttons">
150
		<a href="interfaces_lagg_edit.php" class="btn btn-success"><?=gettext("Add")?></a>
151
	</nav>
152 620e28a7 sbeaver
</div>
153
<?php
154
include("foot.inc");