Project

General

Profile

Download (5.86 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
	pfSense_MODULE:	interfaces
34
*/
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 2af86dda Phil Davis
			}
66
		}
67
	}
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 b705a25b Carlos Eduardo Ramos
$pgtitle = array(gettext("Interfaces"),gettext("LAGG"));
91 b32dd0a6 jim-p
$shortcut_section = "interfaces";
92 94be2ccf Ermal Luçi
include("head.inc");
93
94
?>
95
96
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
97
<?php include("fbegin.inc"); ?>
98
<?php if ($input_errors) print_input_errors($input_errors); ?>
99 edc5535a Colin Fleming
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="interfaces lagg">
100 2af86dda Phil Davis
	<tr><td>
101 94be2ccf Ermal Luçi
<?php
102
	$tab_array = array();
103 b705a25b Carlos Eduardo Ramos
	$tab_array[0] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
104
	$tab_array[1] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
105
	$tab_array[2] = array(gettext("Wireless"), false, "interfaces_wireless.php");
106 77621e7a Carlos Eduardo Ramos
	$tab_array[3] = array(gettext("VLANs"), false, "interfaces_vlan.php");
107
	$tab_array[4] = array(gettext("QinQs"), false, "interfaces_qinq.php");
108
	$tab_array[5] = array(gettext("PPPs"), false, "interfaces_ppps.php");
109
	$tab_array[6] = array(gettext("GRE"), false, "interfaces_gre.php");
110
	$tab_array[7] = array(gettext("GIF"), false, "interfaces_gif.php");
111 b705a25b Carlos Eduardo Ramos
	$tab_array[8] = array(gettext("Bridges"), false, "interfaces_bridge.php");
112 77621e7a Carlos Eduardo Ramos
	$tab_array[9] = array(gettext("LAGG"), true, "interfaces_lagg.php");
113 94be2ccf Ermal Luçi
	display_top_tabs($tab_array);
114
?>
115 2af86dda Phil Davis
	</td></tr>
116
	<tr>
117
		<td>
118
			<div id="mainarea">
119
			<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
120
				<tr>
121
					<td width="20%" class="listhdrr"><?=gettext("Interface"); ?></td>
122
					<td width="20%" class="listhdrr"><?=gettext("Members"); ?></td>
123
					<td width="50%" class="listhdr"><?=gettext("Description"); ?></td>
124
					<td width="10%" class="list"></td>
125 94be2ccf Ermal Luçi
				</tr>
126 2af86dda Phil Davis
<?php
127
		$i = 0;
128
		foreach ($a_laggs as $lagg):
129
?>
130
				<tr  ondblclick="document.location='interfaces_lagg_edit.php?id=<?=$i;?>'">
131
					<td class="listlr">
132
						<?=htmlspecialchars(strtoupper($lagg['laggif']));?>
133
					</td>
134
					<td class="listr">
135
						<?=htmlspecialchars($lagg['members']);?>
136
					</td>
137
					<td class="listbg">
138
						<?=htmlspecialchars($lagg['descr']);?>&nbsp;
139
					</td>
140
					<td valign="middle" class="list nowrap"> <a href="interfaces_lagg_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" alt="edit" /></a>
141
						&nbsp;<a href="interfaces_lagg.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('Do you really want to delete this LAGG interface?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="delete" /></a></td>
142 94be2ccf Ermal Luçi
				</tr>
143 2af86dda Phil Davis
<?php
144
			$i++;
145
		endforeach;
146
?>
147
				<tr>
148
					<td class="list" colspan="3">&nbsp;</td>
149
					<td class="list"> <a href="interfaces_lagg_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="add" /></a></td>
150 94be2ccf Ermal Luçi
				</tr>
151
				<tr>
152 2af86dda Phil Davis
					<td colspan="3" class="list">
153
						<p class="vexpl">
154
							<span class="red"><strong>
155
								<?=gettext("Note:"); ?><br />
156
							</strong></span>
157
							<?=gettext("LAGG allows for link aggregation, bonding and fault tolerance. Only unassigned interfaces can be added to LAGG."); ?>
158
						</p>
159
					</td>
160
					<td class="list">&nbsp;</td>
161 94be2ccf Ermal Luçi
				</tr>
162 2af86dda Phil Davis
			</table>
163
			</div>
164
		</td>
165 94be2ccf Ermal Luçi
	</tr>
166
</table>
167
<?php include("fend.inc"); ?>
168
</body>
169
</html>