1 |
0ec2fdf0
|
Ermal Lu?i
|
<?php
|
2 |
|
|
/*
|
3 |
c5d81585
|
Renato Botelho
|
* interfaces_groups.php
|
4 |
b9043cdc
|
Stephen Beaver
|
*
|
5 |
c5d81585
|
Renato Botelho
|
* part of pfSense (https://www.pfsense.org)
|
6 |
b8f91b7c
|
Luiz Souza
|
* Copyright (c) 2004-2018 Rubicon Communications, LLC (Netgate)
|
7 |
c5d81585
|
Renato Botelho
|
* All rights reserved.
|
8 |
b9043cdc
|
Stephen Beaver
|
*
|
9 |
b12ea3fb
|
Renato Botelho
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
10 |
|
|
* you may not use this file except in compliance with the License.
|
11 |
|
|
* You may obtain a copy of the License at
|
12 |
b9043cdc
|
Stephen Beaver
|
*
|
13 |
b12ea3fb
|
Renato Botelho
|
* http://www.apache.org/licenses/LICENSE-2.0
|
14 |
b9043cdc
|
Stephen Beaver
|
*
|
15 |
b12ea3fb
|
Renato Botelho
|
* Unless required by applicable law or agreed to in writing, software
|
16 |
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
17 |
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18 |
|
|
* See the License for the specific language governing permissions and
|
19 |
|
|
* limitations under the License.
|
20 |
b9043cdc
|
Stephen Beaver
|
*/
|
21 |
0ec2fdf0
|
Ermal Lu?i
|
|
22 |
|
|
##|+PRIV
|
23 |
|
|
##|*IDENT=page-interfaces-groups
|
24 |
5230f468
|
jim-p
|
##|*NAME=Interfaces: Groups
|
25 |
0ec2fdf0
|
Ermal Lu?i
|
##|*DESCR=Create interface groups
|
26 |
|
|
##|*MATCH=interfaces_groups.php*
|
27 |
|
|
##|-PRIV
|
28 |
|
|
|
29 |
c81ef6e2
|
Phil Davis
|
require_once("guiconfig.inc");
|
30 |
654998ee
|
Carlos Eduardo Ramos
|
require_once("functions.inc");
|
31 |
0ec2fdf0
|
Ermal Lu?i
|
|
32 |
2af86dda
|
Phil Davis
|
if (!is_array($config['ifgroups']['ifgroupentry'])) {
|
33 |
0ec2fdf0
|
Ermal Lu?i
|
$config['ifgroups']['ifgroupentry'] = array();
|
34 |
2af86dda
|
Phil Davis
|
}
|
35 |
0ec2fdf0
|
Ermal Lu?i
|
|
36 |
|
|
$a_ifgroups = &$config['ifgroups']['ifgroupentry'];
|
37 |
|
|
|
38 |
e1a5d73c
|
Steve Beaver
|
if ($_POST['act'] == "del") {
|
39 |
|
|
if ($a_ifgroups[$_POST['id']]) {
|
40 |
|
|
$members = explode(" ", $a_ifgroups[$_POST['id']]['members']);
|
41 |
42753d25
|
Ermal Lu?i
|
foreach ($members as $ifs) {
|
42 |
|
|
$realif = get_real_interface($ifs);
|
43 |
2af86dda
|
Phil Davis
|
if ($realif) {
|
44 |
e1a5d73c
|
Steve Beaver
|
mwexec("/sbin/ifconfig {$realif} -group " . $a_ifgroups[$_POST['id']]['ifname']);
|
45 |
2af86dda
|
Phil Davis
|
}
|
46 |
42753d25
|
Ermal Lu?i
|
}
|
47 |
e1a5d73c
|
Steve Beaver
|
unset($a_ifgroups[$_POST['id']]);
|
48 |
0ec2fdf0
|
Ermal Lu?i
|
write_config();
|
49 |
|
|
header("Location: interfaces_groups.php");
|
50 |
|
|
exit;
|
51 |
|
|
}
|
52 |
|
|
}
|
53 |
|
|
|
54 |
26b4bef8
|
k-paulius
|
$pgtitle = array(gettext("Interfaces"), gettext("Interface Groups"));
|
55 |
b32dd0a6
|
jim-p
|
$shortcut_section = "interfaces";
|
56 |
0ec2fdf0
|
Ermal Lu?i
|
|
57 |
19013d43
|
Thane Gill
|
include("head.inc");
|
58 |
0ec2fdf0
|
Ermal Lu?i
|
|
59 |
19013d43
|
Thane Gill
|
$tab_array = array();
|
60 |
26b4bef8
|
k-paulius
|
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
|
61 |
719da9a2
|
Sjon Hortensius
|
$tab_array[] = array(gettext("Interface Groups"), true, "interfaces_groups.php");
|
62 |
|
|
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
|
63 |
|
|
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
|
64 |
|
|
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
|
65 |
|
|
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
|
66 |
26b4bef8
|
k-paulius
|
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
|
67 |
|
|
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
|
68 |
719da9a2
|
Sjon Hortensius
|
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
|
69 |
26b4bef8
|
k-paulius
|
$tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php");
|
70 |
19013d43
|
Thane Gill
|
display_top_tabs($tab_array);
|
71 |
0ec2fdf0
|
Ermal Lu?i
|
?>
|
72 |
060ed238
|
Stephen Beaver
|
<div class="panel panel-default">
|
73 |
70dc5cd6
|
Phil Davis
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext('Interface Groups')?></h2></div>
|
74 |
060ed238
|
Stephen Beaver
|
<div class="panel-body">
|
75 |
|
|
<div class="table-responsive">
|
76 |
1c10ce97
|
PiBa-NL
|
<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
|
77 |
060ed238
|
Stephen Beaver
|
<thead>
|
78 |
|
|
<tr>
|
79 |
|
|
<th><?=gettext('Name');?></th>
|
80 |
|
|
<th><?=gettext('Members');?></th>
|
81 |
|
|
<th><?=gettext('Description');?></th>
|
82 |
70dc5cd6
|
Phil Davis
|
<th><?=gettext('Actions');?></th>
|
83 |
060ed238
|
Stephen Beaver
|
</tr>
|
84 |
|
|
</thead>
|
85 |
|
|
<tbody>
|
86 |
e41d7a1c
|
Sjon Hortensius
|
<?php foreach ($a_ifgroups as $i => $ifgroupentry): ?>
|
87 |
060ed238
|
Stephen Beaver
|
<tr>
|
88 |
|
|
<td>
|
89 |
|
|
<?=htmlspecialchars($ifgroupentry['ifname']); ?>
|
90 |
|
|
</td>
|
91 |
|
|
<td>
|
92 |
2ec0d736
|
sbeaver
|
<?php
|
93 |
|
|
$members_arr = explode(" ", $ifgroupentry['members']);
|
94 |
f593f80b
|
Phil Davis
|
$iflist = get_configured_interface_with_descr(true);
|
95 |
2ec0d736
|
sbeaver
|
$memberses_arr = array();
|
96 |
aa82505e
|
Phil Davis
|
foreach ($members_arr as $memb) {
|
97 |
2ec0d736
|
sbeaver
|
$memberses_arr[] = $iflist[$memb] ? $iflist[$memb] : $memb;
|
98 |
aa82505e
|
Phil Davis
|
}
|
99 |
2ec0d736
|
sbeaver
|
|
100 |
|
|
unset($iflist);
|
101 |
|
|
$memberses = implode(", ", $memberses_arr);
|
102 |
|
|
echo $memberses;
|
103 |
aa82505e
|
Phil Davis
|
if (count($members_arr) >= 10) {
|
104 |
e41d7a1c
|
Sjon Hortensius
|
echo '…';
|
105 |
2ec0d736
|
sbeaver
|
}
|
106 |
|
|
?>
|
107 |
060ed238
|
Stephen Beaver
|
</td>
|
108 |
|
|
<td>
|
109 |
|
|
<?=htmlspecialchars($ifgroupentry['descr']);?>
|
110 |
|
|
</td>
|
111 |
|
|
<td>
|
112 |
4401107f
|
Steve Beaver
|
<a class="fa fa-pencil" title="<?=gettext('Edit group')?>" href="interfaces_groups_edit.php?id=<?=$i; ?>"></a>
|
113 |
e1a5d73c
|
Steve Beaver
|
<a class="fa fa-trash" title="<?=gettext('Delete group')?>" href="interfaces_groups.php?act=del&id=<?=$i; ?>" usepost></a>
|
114 |
060ed238
|
Stephen Beaver
|
</td>
|
115 |
|
|
</tr>
|
116 |
e41d7a1c
|
Sjon Hortensius
|
<?php endforeach; ?>
|
117 |
060ed238
|
Stephen Beaver
|
</tbody>
|
118 |
|
|
</table>
|
119 |
|
|
</div>
|
120 |
|
|
</div>
|
121 |
2ec0d736
|
sbeaver
|
</div>
|
122 |
|
|
|
123 |
c10cb196
|
Stephen Beaver
|
<nav class="action-buttons">
|
124 |
4401107f
|
Steve Beaver
|
<a class="btn btn-success btn-sm" href="interfaces_groups_edit.php" role="button">
|
125 |
9d5a20cf
|
heper
|
<i class="fa fa-plus icon-embed-btn"></i>
|
126 |
2ec8f0ba
|
Stephen Beaver
|
<?=gettext("Add");?>
|
127 |
5ff01d01
|
Sjon Hortensius
|
</a>
|
128 |
|
|
</nav>
|
129 |
|
|
|
130 |
35681930
|
Stephen Beaver
|
<div class="infoblock">
|
131 |
7ae1b34f
|
Phil Davis
|
<?php print_info_box(sprintf(gettext('Interface Groups allow setting up rules for multiple interfaces without duplicating the rules.%s' .
|
132 |
|
|
'If members are removed from an interface group, the group rules are no longer applicable to that interface.'), '<br />'), 'info', false); ?>
|
133 |
2ec8f0ba
|
Stephen Beaver
|
|
134 |
|
|
</div>
|
135 |
2ec0d736
|
sbeaver
|
<?php
|
136 |
|
|
|
137 |
01036a9a
|
Stephen Beaver
|
include("foot.inc");
|