Project

General

Profile

Download (4.62 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	interfaces_lagg.php
5

    
6
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
7
	Copyright (C) 2008 Ermal Luçi
8
	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
/*
32
	pfSense_BUILDER_BINARIES:	/sbin/ifconfig
33
	pfSense_MODULE: interfaces
34
*/
35

    
36
##|+PRIV
37
##|*IDENT=page-interfaces-lagg
38
##|*NAME=Interfaces: LAGG: page
39
##|*DESCR=Allow access to the 'Interfaces: LAGG' page.
40
##|*MATCH=interfaces_lagg.php*
41
##|-PRIV
42

    
43
require("guiconfig.inc");
44

    
45
if (!is_array($config['laggs']['lagg'])) {
46
	$config['laggs']['lagg'] = array();
47
}
48

    
49
$a_laggs = &$config['laggs']['lagg'] ;
50

    
51
function lagg_inuse($num) {
52
	global $config, $a_laggs;
53

    
54
	$iflist = get_configured_interface_list(false, true);
55
	foreach ($iflist as $if) {
56
		if ($config['interfaces'][$if]['if'] == $a_laggs[$num]['laggif']) {
57
			return true;
58
		}
59
	}
60

    
61
	if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
62
		foreach ($config['vlans']['vlan'] as $vlan) {
63
			if ($vlan['if'] == $a_laggs[$num]['laggif']) {
64
				return true;
65
			}
66
		}
67
	}
68
	return false;
69
}
70

    
71
if ($_GET['act'] == "del") {
72
	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
	/* check if still in use */
77
	} else if (lagg_inuse($_GET['id'])) {
78
		$input_errors[] = gettext("This LAGG interface cannot be deleted because it is still being used.");
79
	} else {
80
		mwexec_bg("/sbin/ifconfig " . $a_laggs[$_GET['id']]['laggif'] . " destroy");
81
		unset($a_laggs[$_GET['id']]);
82

    
83
		write_config();
84

    
85
		header("Location: interfaces_lagg.php");
86
		exit;
87
	}
88
}
89

    
90
$pgtitle = array(gettext("Interfaces"), gettext("LAGG"));
91
$shortcut_section = "interfaces";
92
include("head.inc");
93

    
94
if ($input_errors)
95
	print_input_errors($input_errors);
96

    
97
$tab_array = array();
98
$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
display_top_tabs($tab_array);
109
?>
110
<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

    
125
foreach ($a_laggs as $lagg) {
126
?>
127
			<tr>
128
				<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
<?php
143
	$i++;
144
}
145
?>
146
		</tbody>
147
	</table>
148

    
149
	 <nav class="action-buttons">
150
		<a href="interfaces_lagg_edit.php" class="btn btn-success"><?=gettext("Add")?></a>
151
	</nav>
152
</div>
153
<?php
154
include("foot.inc");
(93-93/235)