Project

General

Profile

Download (6.14 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
if (!is_array($config['laggs']['lagg']))
46
	$config['laggs']['lagg'] = array();
47
48
$a_laggs = &$config['laggs']['lagg'] ;
49
50
function lagg_inuse($num) {
51 67b6de9e Ermal Lu?i
	global $config, $a_laggs;
52 94be2ccf Ermal Luçi
53
	$iflist = get_configured_interface_list(false, true);
54
	foreach ($iflist as $if) {
55 2eedb548 Ermal Luçi
		if ($config['interfaces'][$if]['if'] == $a_laggs[$num]['laggif'])
56 94be2ccf Ermal Luçi
			return true;
57
	}
58
59 67b6de9e Ermal Lu?i
	if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
60
                foreach ($config['vlans']['vlan'] as $vlan) {
61
                        if($vlan['if'] == $a_laggs[$num]['laggif'])
62
				return true;
63
                }
64
        }
65 94be2ccf Ermal Luçi
	return false;
66
}
67
68
if ($_GET['act'] == "del") {
69 0e22dda5 Ermal
        if (!isset($_GET['id']))
70 41aa5cd4 Phil Davis
                $input_errors[] = gettext("Wrong parameters supplied");
71 0e22dda5 Ermal
        else if (empty($a_laggs[$_GET['id']]))
72 41aa5cd4 Phil Davis
                $input_errors[] = gettext("Wrong index supplied");
73 94be2ccf Ermal Luçi
	/* check if still in use */
74 0e22dda5 Ermal
	else if (lagg_inuse($_GET['id'])) {
75 b705a25b Carlos Eduardo Ramos
		$input_errors[] = gettext("This LAGG interface cannot be deleted because it is still being used.");
76 94be2ccf Ermal Luçi
	} else {
77 67b6de9e Ermal Lu?i
		mwexec_bg("/sbin/ifconfig " . $a_laggs[$_GET['id']]['laggif'] . " destroy");
78 94be2ccf Ermal Luçi
		unset($a_laggs[$_GET['id']]);
79
80
		write_config();
81
82
		header("Location: interfaces_lagg.php");
83
		exit;
84
	}
85
}
86
87 b705a25b Carlos Eduardo Ramos
$pgtitle = array(gettext("Interfaces"),gettext("LAGG"));
88 b32dd0a6 jim-p
$shortcut_section = "interfaces";
89 94be2ccf Ermal Luçi
include("head.inc");
90
91
?>
92
93
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
94
<?php include("fbegin.inc"); ?>
95
<?php if ($input_errors) print_input_errors($input_errors); ?>
96 edc5535a Colin Fleming
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="interfaces lagg">
97 94be2ccf Ermal Luçi
  <tr><td>
98
<?php
99
	$tab_array = array();
100 b705a25b Carlos Eduardo Ramos
	$tab_array[0] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
101
	$tab_array[1] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
102
	$tab_array[2] = array(gettext("Wireless"), false, "interfaces_wireless.php");
103 77621e7a Carlos Eduardo Ramos
	$tab_array[3] = array(gettext("VLANs"), false, "interfaces_vlan.php");
104
	$tab_array[4] = array(gettext("QinQs"), false, "interfaces_qinq.php");
105
	$tab_array[5] = array(gettext("PPPs"), false, "interfaces_ppps.php");
106
	$tab_array[6] = array(gettext("GRE"), false, "interfaces_gre.php");
107
	$tab_array[7] = array(gettext("GIF"), false, "interfaces_gif.php");
108 b705a25b Carlos Eduardo Ramos
	$tab_array[8] = array(gettext("Bridges"), false, "interfaces_bridge.php");
109 77621e7a Carlos Eduardo Ramos
	$tab_array[9] = array(gettext("LAGG"), true, "interfaces_lagg.php");
110 94be2ccf Ermal Luçi
	display_top_tabs($tab_array);
111
?>
112
  </td></tr>
113
  <tr>
114
    <td>
115
	<div id="mainarea">
116 edc5535a Colin Fleming
	<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
117 94be2ccf Ermal Luçi
                <tr>
118 b705a25b Carlos Eduardo Ramos
                  <td width="20%" class="listhdrr"><?=gettext("Interface"); ?></td>
119
                  <td width="20%" class="listhdrr"><?=gettext("Members"); ?></td>
120
                  <td width="50%" class="listhdr"><?=gettext("Description"); ?></td>
121 94be2ccf Ermal Luçi
                  <td width="10%" class="list"></td>
122
				</tr>
123
			  <?php $i = 0; foreach ($a_laggs as $lagg): ?>
124 fd22be34 Ermal Lu?i
                <tr  ondblclick="document.location='interfaces_lagg_edit.php?id=<?=$i;?>'">
125 94be2ccf Ermal Luçi
                  <td class="listlr">
126 6c6a618a Ermal Luçi
					<?=htmlspecialchars(strtoupper($lagg['laggif']));?>
127 94be2ccf Ermal Luçi
                  </td>
128
                  <td class="listr">
129
					<?=htmlspecialchars($lagg['members']);?>
130
                  </td>
131
                  <td class="listbg">
132
                    <?=htmlspecialchars($lagg['descr']);?>&nbsp;
133
                  </td>
134 edc5535a Colin Fleming
                  <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>
135
                     &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>
136 94be2ccf Ermal Luçi
				</tr>
137
			  <?php $i++; endforeach; ?>
138
                <tr>
139
                  <td class="list" colspan="3">&nbsp;</td>
140 edc5535a Colin Fleming
                  <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>
141 94be2ccf Ermal Luçi
				</tr>
142
				<tr>
143
				<td colspan="3" class="list"><p class="vexpl"><span class="red"><strong>
144 1d7ba683 ayvis
				  <?=gettext("Note:"); ?><br />
145 94be2ccf Ermal Luçi
				  </strong></span>
146 edc5535a Colin Fleming
				  <?=gettext("LAGG allows for link aggregation, bonding and fault tolerance. Only unassigned interfaces can be added to LAGG."); ?></p>
147 94be2ccf Ermal Luçi
				  </td>
148
				<td class="list">&nbsp;</td>
149
				</tr>
150
              </table>
151
	      </div>
152
	</td>
153
	</tr>
154
</table>
155
<?php include("fend.inc"); ?>
156
</body>
157
</html>