Project

General

Profile

Download (4.41 KB) Statistics
| Branch: | Tag: | Revision:
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 38809d47 Renato Botelho do Couto
 * Copyright (c) 2004-2013 BSD Perimeter
7
 * Copyright (c) 2013-2016 Electric Sheep Fencing
8
 * Copyright (c) 2014-2019 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 0ec2fdf0 Ermal Lu?i
24
##|+PRIV
25
##|*IDENT=page-interfaces-groups
26 5230f468 jim-p
##|*NAME=Interfaces: Groups
27 0ec2fdf0 Ermal Lu?i
##|*DESCR=Create interface groups
28
##|*MATCH=interfaces_groups.php*
29
##|-PRIV
30
31 c81ef6e2 Phil Davis
require_once("guiconfig.inc");
32 654998ee Carlos Eduardo Ramos
require_once("functions.inc");
33 0ec2fdf0 Ermal Lu?i
34 c6c398c6 jim-p
init_config_arr(array('ifgroups', 'ifgroupentry'));
35 0ec2fdf0 Ermal Lu?i
$a_ifgroups = &$config['ifgroups']['ifgroupentry'];
36
37 e1a5d73c Steve Beaver
if ($_POST['act'] == "del") {
38
	if ($a_ifgroups[$_POST['id']]) {
39
		$members = explode(" ", $a_ifgroups[$_POST['id']]['members']);
40 42753d25 Ermal Lu?i
		foreach ($members as $ifs) {
41
			$realif = get_real_interface($ifs);
42 2af86dda Phil Davis
			if ($realif) {
43 e1a5d73c Steve Beaver
				mwexec("/sbin/ifconfig {$realif} -group " . $a_ifgroups[$_POST['id']]['ifname']);
44 2af86dda Phil Davis
			}
45 42753d25 Ermal Lu?i
		}
46 e1a5d73c Steve Beaver
		unset($a_ifgroups[$_POST['id']]);
47 0ec2fdf0 Ermal Lu?i
		write_config();
48
		header("Location: interfaces_groups.php");
49
		exit;
50
	}
51
}
52
53 26b4bef8 k-paulius
$pgtitle = array(gettext("Interfaces"), gettext("Interface Groups"));
54 b32dd0a6 jim-p
$shortcut_section = "interfaces";
55 0ec2fdf0 Ermal Lu?i
56 19013d43 Thane Gill
include("head.inc");
57 0ec2fdf0 Ermal Lu?i
58 19013d43 Thane Gill
$tab_array = array();
59 26b4bef8 k-paulius
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
60 719da9a2 Sjon Hortensius
$tab_array[] = array(gettext("Interface Groups"), true, "interfaces_groups.php");
61
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
62
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
63
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
64
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
65 26b4bef8 k-paulius
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
66
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
67 719da9a2 Sjon Hortensius
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
68 26b4bef8 k-paulius
$tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php");
69 19013d43 Thane Gill
display_top_tabs($tab_array);
70 0ec2fdf0 Ermal Lu?i
?>
71 060ed238 Stephen Beaver
<div class="panel panel-default">
72 70dc5cd6 Phil Davis
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('Interface Groups')?></h2></div>
73 060ed238 Stephen Beaver
	<div class="panel-body">
74
		<div class="table-responsive">
75 1c10ce97 PiBa-NL
			<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
76 060ed238 Stephen Beaver
				<thead>
77
					<tr>
78
						<th><?=gettext('Name');?></th>
79
						<th><?=gettext('Members');?></th>
80
						<th><?=gettext('Description');?></th>
81 70dc5cd6 Phil Davis
						<th><?=gettext('Actions');?></th>
82 060ed238 Stephen Beaver
					</tr>
83
				</thead>
84
				<tbody>
85 e41d7a1c Sjon Hortensius
<?php foreach ($a_ifgroups as $i => $ifgroupentry): ?>
86 060ed238 Stephen Beaver
					<tr>
87
						<td>
88
							<?=htmlspecialchars($ifgroupentry['ifname']); ?>
89
						</td>
90
						<td>
91 2ec0d736 sbeaver
<?php
92
		$members_arr = explode(" ", $ifgroupentry['members']);
93 f593f80b Phil Davis
		$iflist = get_configured_interface_with_descr(true);
94 2ec0d736 sbeaver
		$memberses_arr = array();
95 aa82505e Phil Davis
		foreach ($members_arr as $memb) {
96 2ec0d736 sbeaver
			$memberses_arr[] = $iflist[$memb] ? $iflist[$memb] : $memb;
97 aa82505e Phil Davis
		}
98 2ec0d736 sbeaver
99
		unset($iflist);
100
		$memberses = implode(", ", $memberses_arr);
101
		echo $memberses;
102 aa82505e Phil Davis
		if (count($members_arr) >= 10) {
103 e41d7a1c Sjon Hortensius
			echo '&hellip;';
104 2ec0d736 sbeaver
		}
105
?>
106 060ed238 Stephen Beaver
						</td>
107
						<td>
108
							<?=htmlspecialchars($ifgroupentry['descr']);?>
109
						</td>
110
						<td>
111 4401107f Steve Beaver
							<a class="fa fa-pencil"	title="<?=gettext('Edit group')?>"	href="interfaces_groups_edit.php?id=<?=$i; ?>"></a>
112 e1a5d73c Steve Beaver
							<a class="fa fa-trash"	title="<?=gettext('Delete group')?>"	href="interfaces_groups.php?act=del&amp;id=<?=$i; ?>" usepost></a>
113 060ed238 Stephen Beaver
						</td>
114
					</tr>
115 e41d7a1c Sjon Hortensius
<?php endforeach; ?>
116 060ed238 Stephen Beaver
				</tbody>
117
			</table>
118
		</div>
119
	</div>
120 2ec0d736 sbeaver
</div>
121
122 c10cb196 Stephen Beaver
<nav class="action-buttons">
123 4401107f Steve Beaver
	<a class="btn btn-success btn-sm" href="interfaces_groups_edit.php" role="button">
124 9d5a20cf heper
		<i class="fa fa-plus icon-embed-btn"></i>
125 2ec8f0ba Stephen Beaver
		<?=gettext("Add");?>
126 5ff01d01 Sjon Hortensius
	</a>
127
</nav>
128
129 35681930 Stephen Beaver
<div class="infoblock">
130 7ae1b34f Phil Davis
	<?php print_info_box(sprintf(gettext('Interface Groups allow setting up rules for multiple interfaces without duplicating the rules.%s' .
131
					   'If members are removed from an interface group, the group rules are no longer applicable to that interface.'), '<br />'), 'info', false); ?>
132 2ec8f0ba Stephen Beaver
133
</div>
134 2ec0d736 sbeaver
<?php
135
136 01036a9a Stephen Beaver
include("foot.inc");