1 |
94be2ccf
|
Ermal Luçi
|
<?php
|
2 |
|
|
/*
|
3 |
c5d81585
|
Renato Botelho
|
* interfaces_lagg.php
|
4 |
b9043cdc
|
Stephen Beaver
|
*
|
5 |
c5d81585
|
Renato Botelho
|
* part of pfSense (https://www.pfsense.org)
|
6 |
38809d47
|
Renato Botelho do Couto
|
* Copyright (c) 2004-2013 BSD Perimeter
|
7 |
|
|
* Copyright (c) 2013-2016 Electric Sheep Fencing
|
8 |
402c98a2
|
Reid Linnemann
|
* Copyright (c) 2014-2023 Rubicon Communications, LLC (Netgate)
|
9 |
c5d81585
|
Renato Botelho
|
* All rights reserved.
|
10 |
b9043cdc
|
Stephen Beaver
|
*
|
11 |
b12ea3fb
|
Renato Botelho
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
12 |
|
|
* you may not use this file except in compliance with the License.
|
13 |
|
|
* You may obtain a copy of the License at
|
14 |
b9043cdc
|
Stephen Beaver
|
*
|
15 |
b12ea3fb
|
Renato Botelho
|
* http://www.apache.org/licenses/LICENSE-2.0
|
16 |
b9043cdc
|
Stephen Beaver
|
*
|
17 |
b12ea3fb
|
Renato Botelho
|
* Unless required by applicable law or agreed to in writing, software
|
18 |
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
19 |
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
20 |
|
|
* See the License for the specific language governing permissions and
|
21 |
|
|
* limitations under the License.
|
22 |
b9043cdc
|
Stephen Beaver
|
*/
|
23 |
7ac5a4cb
|
Scott Ullrich
|
|
24 |
|
|
##|+PRIV
|
25 |
7997ed44
|
Renato Botelho
|
##|*IDENT=page-interfaces-lagg
|
26 |
5230f468
|
jim-p
|
##|*NAME=Interfaces: LAGG:
|
27 |
7997ed44
|
Renato Botelho
|
##|*DESCR=Allow access to the 'Interfaces: LAGG' page.
|
28 |
7ac5a4cb
|
Scott Ullrich
|
##|*MATCH=interfaces_lagg.php*
|
29 |
|
|
##|-PRIV
|
30 |
94be2ccf
|
Ermal Luçi
|
|
31 |
c81ef6e2
|
Phil Davis
|
require_once("guiconfig.inc");
|
32 |
94be2ccf
|
Ermal Luçi
|
|
33 |
c6c398c6
|
jim-p
|
init_config_arr(array('laggs', 'lagg'));
|
34 |
94be2ccf
|
Ermal Luçi
|
$a_laggs = &$config['laggs']['lagg'] ;
|
35 |
|
|
|
36 |
|
|
function lagg_inuse($num) {
|
37 |
67b6de9e
|
Ermal Lu?i
|
global $config, $a_laggs;
|
38 |
94be2ccf
|
Ermal Luçi
|
|
39 |
80fe8369
|
Phil Davis
|
$iflist = get_configured_interface_list(true);
|
40 |
94be2ccf
|
Ermal Luçi
|
foreach ($iflist as $if) {
|
41 |
2af86dda
|
Phil Davis
|
if ($config['interfaces'][$if]['if'] == $a_laggs[$num]['laggif']) {
|
42 |
94be2ccf
|
Ermal Luçi
|
return true;
|
43 |
2af86dda
|
Phil Davis
|
}
|
44 |
94be2ccf
|
Ermal Luçi
|
}
|
45 |
|
|
|
46 |
960388e0
|
jim-p
|
foreach (config_get_path('vlans/vlan', []) as $vlan) {
|
47 |
|
|
if ($vlan['if'] == $a_laggs[$num]['laggif']) {
|
48 |
|
|
return true;
|
49 |
2af86dda
|
Phil Davis
|
}
|
50 |
fb455ab4
|
Sjon Hortensius
|
}
|
51 |
94be2ccf
|
Ermal Luçi
|
return false;
|
52 |
|
|
}
|
53 |
|
|
|
54 |
41063bd7
|
Steve Beaver
|
if ($_POST['act'] == "del") {
|
55 |
|
|
if (!isset($_POST['id'])) {
|
56 |
2af86dda
|
Phil Davis
|
$input_errors[] = gettext("Wrong parameters supplied");
|
57 |
41063bd7
|
Steve Beaver
|
} else if (empty($a_laggs[$_POST['id']])) {
|
58 |
2af86dda
|
Phil Davis
|
$input_errors[] = gettext("Wrong index supplied");
|
59 |
94be2ccf
|
Ermal Luçi
|
/* check if still in use */
|
60 |
41063bd7
|
Steve Beaver
|
} else if (lagg_inuse($_POST['id'])) {
|
61 |
b705a25b
|
Carlos Eduardo Ramos
|
$input_errors[] = gettext("This LAGG interface cannot be deleted because it is still being used.");
|
62 |
94be2ccf
|
Ermal Luçi
|
} else {
|
63 |
41063bd7
|
Steve Beaver
|
pfSense_interface_destroy($a_laggs[$_POST['id']]['laggif']);
|
64 |
|
|
unset($a_laggs[$_POST['id']]);
|
65 |
94be2ccf
|
Ermal Luçi
|
|
66 |
e85ae672
|
Renato Botelho do Couto
|
write_config("LAGG interface deleted");
|
67 |
94be2ccf
|
Ermal Luçi
|
|
68 |
|
|
header("Location: interfaces_lagg.php");
|
69 |
|
|
exit;
|
70 |
|
|
}
|
71 |
|
|
}
|
72 |
|
|
|
73 |
26b4bef8
|
k-paulius
|
$pgtitle = array(gettext("Interfaces"), gettext("LAGGs"));
|
74 |
b32dd0a6
|
jim-p
|
$shortcut_section = "interfaces";
|
75 |
94be2ccf
|
Ermal Luçi
|
include("head.inc");
|
76 |
|
|
|
77 |
aa82505e
|
Phil Davis
|
if ($input_errors) {
|
78 |
620e28a7
|
sbeaver
|
print_input_errors($input_errors);
|
79 |
aa82505e
|
Phil Davis
|
}
|
80 |
620e28a7
|
sbeaver
|
|
81 |
|
|
$tab_array = array();
|
82 |
26b4bef8
|
k-paulius
|
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
|
83 |
fb455ab4
|
Sjon Hortensius
|
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
|
84 |
|
|
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
|
85 |
|
|
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
|
86 |
|
|
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
|
87 |
|
|
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
|
88 |
26b4bef8
|
k-paulius
|
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
|
89 |
|
|
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
|
90 |
fb455ab4
|
Sjon Hortensius
|
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
|
91 |
26b4bef8
|
k-paulius
|
$tab_array[] = array(gettext("LAGGs"), true, "interfaces_lagg.php");
|
92 |
620e28a7
|
sbeaver
|
display_top_tabs($tab_array);
|
93 |
94be2ccf
|
Ermal Luçi
|
?>
|
94 |
060ed238
|
Stephen Beaver
|
<div class="panel panel-default">
|
95 |
70dc5cd6
|
Phil Davis
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext('LAGG Interfaces')?></h2></div>
|
96 |
060ed238
|
Stephen Beaver
|
<div class="panel-body">
|
97 |
|
|
<div class="table-responsive">
|
98 |
1c10ce97
|
PiBa-NL
|
<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
|
99 |
060ed238
|
Stephen Beaver
|
<thead>
|
100 |
|
|
<tr>
|
101 |
70dc5cd6
|
Phil Davis
|
<th><?=gettext("Interface"); ?></th>
|
102 |
|
|
<th><?=gettext("Members"); ?></th>
|
103 |
|
|
<th><?=gettext("Description"); ?></th>
|
104 |
|
|
<th><?=gettext("Actions"); ?></th>
|
105 |
060ed238
|
Stephen Beaver
|
</tr>
|
106 |
|
|
</thead>
|
107 |
|
|
<tbody>
|
108 |
620e28a7
|
sbeaver
|
<?php
|
109 |
|
|
|
110 |
|
|
$i = 0;
|
111 |
94be2ccf
|
Ermal Luçi
|
|
112 |
620e28a7
|
sbeaver
|
foreach ($a_laggs as $lagg) {
|
113 |
|
|
?>
|
114 |
060ed238
|
Stephen Beaver
|
<tr>
|
115 |
|
|
<td>
|
116 |
|
|
<?=htmlspecialchars(strtoupper($lagg['laggif']))?>
|
117 |
|
|
</td>
|
118 |
|
|
<td>
|
119 |
|
|
<?=htmlspecialchars($lagg['members'])?>
|
120 |
|
|
</td>
|
121 |
|
|
<td>
|
122 |
|
|
<?=htmlspecialchars($lagg['descr'])?>
|
123 |
|
|
</td>
|
124 |
|
|
<td>
|
125 |
4401107f
|
Steve Beaver
|
<a class="fa fa-pencil" title="<?=gettext('Edit LAGG interface')?>" href="interfaces_lagg_edit.php?id=<?=$i?>"></a>
|
126 |
41063bd7
|
Steve Beaver
|
<a class="fa fa-trash" title="<?=gettext('Delete LAGG interface')?>" href="interfaces_lagg.php?act=del&id=<?=$i?>" usepost></a>
|
127 |
060ed238
|
Stephen Beaver
|
</td>
|
128 |
|
|
</tr>
|
129 |
94be2ccf
|
Ermal Luçi
|
<?php
|
130 |
620e28a7
|
sbeaver
|
$i++;
|
131 |
|
|
}
|
132 |
94be2ccf
|
Ermal Luçi
|
?>
|
133 |
060ed238
|
Stephen Beaver
|
</tbody>
|
134 |
|
|
</table>
|
135 |
|
|
</div>
|
136 |
|
|
</div>
|
137 |
620e28a7
|
sbeaver
|
</div>
|
138 |
060ed238
|
Stephen Beaver
|
|
139 |
|
|
<nav class="action-buttons">
|
140 |
4401107f
|
Steve Beaver
|
<a href="interfaces_lagg_edit.php" class="btn btn-success btn-sm">
|
141 |
060ed238
|
Stephen Beaver
|
<i class="fa fa-plus icon-embed-btn"></i>
|
142 |
|
|
<?=gettext("Add")?>
|
143 |
|
|
</a>
|
144 |
|
|
</nav>
|
145 |
|
|
|
146 |
620e28a7
|
sbeaver
|
<?php
|
147 |
|
|
include("foot.inc");
|