Project

General

Profile

Download (4.72 KB) Statistics
| Branch: | Tag: | Revision:
1 0ec2fdf0 Ermal Lu?i
<?php
2
/*
3 ce77a9c4 Phil Davis
	interfaces_groups.php
4
5
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
6 1d7ba683 ayvis
	Copyright (C) 2009 Ermal Luçi
7 0ec2fdf0 Ermal Lu?i
	Copyright (C) 2004 Scott Ullrich
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 7ac5a4cb Scott Ullrich
/*
32
	pfSense_BUILDER_BINARIES:	/sbin/ifconfig
33 2ec0d736 sbeaver
	pfSense_MODULE: interfaces
34 7ac5a4cb Scott Ullrich
*/
35 0ec2fdf0 Ermal Lu?i
36
##|+PRIV
37
##|*IDENT=page-interfaces-groups
38
##|*NAME=Interfaces: Groups page
39
##|*DESCR=Create interface groups
40
##|*MATCH=interfaces_groups.php*
41
##|-PRIV
42
43
require("guiconfig.inc");
44 654998ee Carlos Eduardo Ramos
require_once("functions.inc");
45 0ec2fdf0 Ermal Lu?i
46 2af86dda Phil Davis
if (!is_array($config['ifgroups']['ifgroupentry'])) {
47 0ec2fdf0 Ermal Lu?i
	$config['ifgroups']['ifgroupentry'] = array();
48 2af86dda Phil Davis
}
49 0ec2fdf0 Ermal Lu?i
50
$a_ifgroups = &$config['ifgroups']['ifgroupentry'];
51
52
if ($_GET['act'] == "del") {
53
	if ($a_ifgroups[$_GET['id']]) {
54 073cd52e Ermal
		$members = explode(" ", $a_ifgroups[$_GET['id']]['members']);
55 42753d25 Ermal Lu?i
		foreach ($members as $ifs) {
56
			$realif = get_real_interface($ifs);
57 2af86dda Phil Davis
			if ($realif) {
58 19013d43 Thane Gill
				mwexec("/sbin/ifconfig {$realif} -group " . $a_ifgroups[$_GET['id']]['ifname']);
59 2af86dda Phil Davis
			}
60 42753d25 Ermal Lu?i
		}
61 0ec2fdf0 Ermal Lu?i
		unset($a_ifgroups[$_GET['id']]);
62
		write_config();
63
		header("Location: interfaces_groups.php");
64
		exit;
65
	}
66
}
67
68 6c07db48 Phil Davis
$pgtitle = array(gettext("Interfaces"), gettext("Groups"));
69 b32dd0a6 jim-p
$shortcut_section = "interfaces";
70 0ec2fdf0 Ermal Lu?i
71 19013d43 Thane Gill
include("head.inc");
72 0ec2fdf0 Ermal Lu?i
73 19013d43 Thane Gill
$tab_array = array();
74 719da9a2 Sjon Hortensius
$tab_array[] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
75
$tab_array[] = array(gettext("Interface Groups"), true, "interfaces_groups.php");
76
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
77
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
78
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
79
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
80
$tab_array[] = array(gettext("GRE"), false, "interfaces_gre.php");
81
$tab_array[] = array(gettext("GIF"), false, "interfaces_gif.php");
82
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
83
$tab_array[] = array(gettext("LAGG"), false, "interfaces_lagg.php");
84 19013d43 Thane Gill
display_top_tabs($tab_array);
85 0ec2fdf0 Ermal Lu?i
86 2ec0d736 sbeaver
print_info_box(gettext('Interface Groups allow you to setup rules for multiple interfaces without duplicating the rules.<br />' .
87
					   'If you remove members from an interface group, the group rules are no longer applicable to that interface.'));
88 0ec2fdf0 Ermal Lu?i
?>
89 2ec0d736 sbeaver
<div class="table-responsive">
90
	<table class="table table-striped table-hover table-condensed">
91
		<thead>
92
			<tr>
93 719da9a2 Sjon Hortensius
				<th><?=gettext('Name');?></th>
94 2ec0d736 sbeaver
				<th><?=gettext('Members');?></th>
95
				<th><?=gettext('Description');?></th>
96
				<th></th>
97
			</tr>
98
		</thead>
99
		<tbody>
100 e41d7a1c Sjon Hortensius
<?php foreach ($a_ifgroups as $i => $ifgroupentry): ?>
101 2ec0d736 sbeaver
			<tr>
102
				<td>
103
					<?=htmlspecialchars($ifgroupentry['ifname']); ?>
104
				</td>
105
				<td>
106
<?php
107
		$members_arr = explode(" ", $ifgroupentry['members']);
108
		$iflist = get_configured_interface_with_descr(false, true);
109
		$memberses_arr = array();
110
		foreach ($members_arr as $memb)
111
			$memberses_arr[] = $iflist[$memb] ? $iflist[$memb] : $memb;
112
113
		unset($iflist);
114
		$memberses = implode(", ", $memberses_arr);
115
		echo $memberses;
116 e41d7a1c Sjon Hortensius
		if(count($members_arr) >= 10) {
117
			echo '&hellip;';
118 2ec0d736 sbeaver
		}
119
?>
120
				</td>
121
				<td>
122
					<?=htmlspecialchars($ifgroupentry['descr']);?>
123
				</td>
124
				<td>
125 e41d7a1c Sjon Hortensius
					<a class="btn btn-default btn-sm" role="button" href="interfaces_groups_edit.php?id=<?=$i; ?>">
126
						<?=gettext('Edit'); ?>
127
					</a>
128
					<a class="btn btn-danger btn-sm" role="button" href="interfaces_groups.php?act=del&amp;id=<?=$i; ?>">
129
						<?=gettext("Delete"); ?>
130
					</a>
131 2ec0d736 sbeaver
				</td>
132
			</tr>
133 e41d7a1c Sjon Hortensius
<?php endforeach; ?>
134 2ec0d736 sbeaver
		</tbody>
135
	</table>
136
</div>
137
138 5ff01d01 Sjon Hortensius
<nav class="action-buttons">
139
	<a class="btn btn-success btn-sm" href="interfaces_groups_edit.php" role="button">
140
		<?=gettext("Add Group");?>
141
	</a>
142
</nav>
143
144 2ec0d736 sbeaver
<?php
145
146
include("fend.inc");