Project

General

Profile

Download (5.53 KB) Statistics
| Branch: | Tag: | Revision:
1 94be2ccf Ermal Luçi
<?php
2
/* $Id$ */
3
/*
4
	interfaces_lagg.php
5
6
	Copyright (C) 2008 Ermal Lu?i
7
	All rights reserved.
8
9
	Redistribution and use in source and binary forms, with or without
10
	modification, are permitted provided that the following conditions are met:
11
12
	1. Redistributions of source code must retain the above copyright notice,
13
	   this list of conditions and the following disclaimer.
14
15
	2. Redistributions in binary form must reproduce the above copyright
16
	   notice, this list of conditions and the following disclaimer in the
17
	   documentation and/or other materials provided with the distribution.
18
19
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
23
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
	POSSIBILITY OF SUCH DAMAGE.
29
*/
30 7ac5a4cb Scott Ullrich
/*
31
	pfSense_BUILDER_BINARIES:	/sbin/ifconfig
32
	pfSense_MODULE:	interfaces
33
*/
34
35
##|+PRIV
36
##|*IDENT=page-interfacess-lagg
37
##|*NAME=Interfaces: LAGG: page
38
##|*DESCR=Edit Interface LAGG
39
##|*MATCH=interfaces_lagg.php*
40
##|-PRIV
41 94be2ccf Ermal Luçi
42
require("guiconfig.inc");
43
44
if (!is_array($config['laggs']['lagg']))
45
	$config['laggs']['lagg'] = array();
46
47
$a_laggs = &$config['laggs']['lagg'] ;
48
49
function lagg_inuse($num) {
50 67b6de9e Ermal Lu?i
	global $config, $a_laggs;
51 94be2ccf Ermal Luçi
52
	$iflist = get_configured_interface_list(false, true);
53
	foreach ($iflist as $if) {
54 2eedb548 Ermal Luçi
		if ($config['interfaces'][$if]['if'] == $a_laggs[$num]['laggif'])
55 94be2ccf Ermal Luçi
			return true;
56
	}
57
58 67b6de9e Ermal Lu?i
	if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
59
                foreach ($config['vlans']['vlan'] as $vlan) {
60
                        if($vlan['if'] == $a_laggs[$num]['laggif'])
61
				return true;
62
                }
63
        }
64 94be2ccf Ermal Luçi
	return false;
65
}
66
67
if ($_GET['act'] == "del") {
68
	/* check if still in use */
69
	if (lagg_inuse($_GET['id'])) {
70
		$input_errors[] = "This lagg interface cannot be deleted because it is still being used.";
71
	} else {
72 67b6de9e Ermal Lu?i
		mwexec_bg("/sbin/ifconfig " . $a_laggs[$_GET['id']]['laggif'] . " destroy");
73 94be2ccf Ermal Luçi
		unset($a_laggs[$_GET['id']]);
74
75
		write_config();
76
77
		header("Location: interfaces_lagg.php");
78
		exit;
79
	}
80
}
81
82
$pgtitle = array("Interfaces","LAGG");
83
include("head.inc");
84
85
?>
86
87
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
88
<?php include("fbegin.inc"); ?>
89
<?php if ($input_errors) print_input_errors($input_errors); ?>
90
<table width="100%" border="0" cellpadding="0" cellspacing="0">
91
  <tr><td>
92
<?php
93
	$tab_array = array();
94
	$tab_array[0] = array("Interface assignments", false, "interfaces_assign.php");
95 0ec2fdf0 Ermal Lu?i
	$tab_array[1] = array("Interface Groups", false, "interfaces_groups.php");
96 79637b03 Erik Fonnesbeck
	$tab_array[2] = array("Wireless", false, "interfaces_wireless.php");
97
	$tab_array[3] = array("VLANs", false, "interfaces_vlan.php");
98
	$tab_array[4] = array("QinQs", false, "interfaces_qinq.php");
99
	$tab_array[5] = array("PPP", false, "interfaces_ppp.php");
100
	$tab_array[6] = array("GRE", false, "interfaces_gre.php");
101
	$tab_array[7] = array("GIF", false, "interfaces_gif.php");
102
	$tab_array[8] = array("Bridges", false, "interfaces_bridge.php");
103
        $tab_array[9] = array("LAGG", true, "interfaces_lagg.php");
104 94be2ccf Ermal Luçi
	display_top_tabs($tab_array);
105
?>
106
  </td></tr>
107
  <tr>
108
    <td>
109
	<div id="mainarea">
110
	<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
111
                <tr>
112
                  <td width="20%" class="listhdrr">Interface</td>
113
                  <td width="20%" class="listhdrr">Members</td>
114
                  <td width="50%" class="listhdr">Description</td>
115
                  <td width="10%" class="list"></td>
116
				</tr>
117
			  <?php $i = 0; foreach ($a_laggs as $lagg): ?>
118 fd22be34 Ermal Lu?i
                <tr  ondblclick="document.location='interfaces_lagg_edit.php?id=<?=$i;?>'">
119 94be2ccf Ermal Luçi
                  <td class="listlr">
120 6c6a618a Ermal Luçi
					<?=htmlspecialchars(strtoupper($lagg['laggif']));?>
121 94be2ccf Ermal Luçi
                  </td>
122
                  <td class="listr">
123
					<?=htmlspecialchars($lagg['members']);?>
124
                  </td>
125
                  <td class="listbg">
126
                    <?=htmlspecialchars($lagg['descr']);?>&nbsp;
127
                  </td>
128
                  <td valign="middle" nowrap class="list"> <a href="interfaces_lagg_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a>
129 0605bbe3 Ermal Luçi
                     &nbsp;<a href="interfaces_lagg.php?act=del&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"></a></td>
130 94be2ccf Ermal Luçi
				</tr>
131
			  <?php $i++; endforeach; ?>
132
                <tr>
133
                  <td class="list" colspan="3">&nbsp;</td>
134
                  <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"></a></td>
135
				</tr>
136
				<tr>
137
				<td colspan="3" class="list"><p class="vexpl"><span class="red"><strong>
138
				  Note:<br>
139
				  </strong></span>
140 77456954 Chris Buechler
				  Lagg allows for link aggregation, for bonding and fault tolerance. Only un-assigned interfaces can be added to lagg.
141 94be2ccf Ermal Luçi
				  </td>
142
				<td class="list">&nbsp;</td>
143
				</tr>
144
              </table>
145
	      </div>
146
	</td>
147
	</tr>
148
</table>
149
<?php include("fend.inc"); ?>
150
</body>
151
</html>