Project

General

Profile

Download (6.01 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
 * interfaces_groups.php
4
 *
5
 * part of pfSense (https://www.pfsense.org)
6
 * Copyright (c) 2004-2016 Electric Sheep Fencing, LLC
7
 * All rights reserved.
8
 *
9
 * Redistribution and use in source and binary forms, with or without
10
 * modification, are permitted provided that the following conditions are met:
11
 *
12
 * 1. Redistributions of source code must retain the above copyright notice,
13
 *    this list of conditions and the following disclaimer.
14
 *
15
 * 2. Redistributions in binary form must reproduce the above copyright
16
 *    notice, this list of conditions and the following disclaimer in
17
 *    the documentation and/or other materials provided with the
18
 *    distribution.
19
 *
20
 * 3. All advertising materials mentioning features or use of this software
21
 *    must display the following acknowledgment:
22
 *    "This product includes software developed by the pfSense Project
23
 *    for use in the pfSense® software distribution. (http://www.pfsense.org/).
24
 *
25
 * 4. The names "pfSense" and "pfSense Project" must not be used to
26
 *    endorse or promote products derived from this software without
27
 *    prior written permission. For written permission, please contact
28
 *    coreteam@pfsense.org.
29
 *
30
 * 5. Products derived from this software may not be called "pfSense"
31
 *    nor may "pfSense" appear in their names without prior written
32
 *    permission of the Electric Sheep Fencing, LLC.
33
 *
34
 * 6. Redistributions of any form whatsoever must retain the following
35
 *    acknowledgment:
36
 *
37
 * "This product includes software developed by the pfSense Project
38
 * for use in the pfSense software distribution (http://www.pfsense.org/).
39
 *
40
 * THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
41
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
44
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51
 * OF THE POSSIBILITY OF SUCH DAMAGE.
52
 */
53

    
54
##|+PRIV
55
##|*IDENT=page-interfaces-groups
56
##|*NAME=Interfaces: Groups
57
##|*DESCR=Create interface groups
58
##|*MATCH=interfaces_groups.php*
59
##|-PRIV
60

    
61
require_once("guiconfig.inc");
62
require_once("functions.inc");
63

    
64
if (!is_array($config['ifgroups']['ifgroupentry'])) {
65
	$config['ifgroups']['ifgroupentry'] = array();
66
}
67

    
68
$a_ifgroups = &$config['ifgroups']['ifgroupentry'];
69

    
70
if ($_GET['act'] == "del") {
71
	if ($a_ifgroups[$_GET['id']]) {
72
		$members = explode(" ", $a_ifgroups[$_GET['id']]['members']);
73
		foreach ($members as $ifs) {
74
			$realif = get_real_interface($ifs);
75
			if ($realif) {
76
				mwexec("/sbin/ifconfig {$realif} -group " . $a_ifgroups[$_GET['id']]['ifname']);
77
			}
78
		}
79
		unset($a_ifgroups[$_GET['id']]);
80
		write_config();
81
		header("Location: interfaces_groups.php");
82
		exit;
83
	}
84
}
85

    
86
$pgtitle = array(gettext("Interfaces"), gettext("Interface Groups"));
87
$shortcut_section = "interfaces";
88

    
89
include("head.inc");
90

    
91
$tab_array = array();
92
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
93
$tab_array[] = array(gettext("Interface Groups"), true, "interfaces_groups.php");
94
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
95
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
96
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
97
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
98
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
99
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
100
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
101
$tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php");
102
display_top_tabs($tab_array);
103
?>
104
<div class="panel panel-default">
105
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('Interface Groups')?></h2></div>
106
	<div class="panel-body">
107
		<div class="table-responsive">
108
			<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
109
				<thead>
110
					<tr>
111
						<th><?=gettext('Name');?></th>
112
						<th><?=gettext('Members');?></th>
113
						<th><?=gettext('Description');?></th>
114
						<th><?=gettext('Actions');?></th>
115
					</tr>
116
				</thead>
117
				<tbody>
118
<?php foreach ($a_ifgroups as $i => $ifgroupentry): ?>
119
					<tr>
120
						<td>
121
							<?=htmlspecialchars($ifgroupentry['ifname']); ?>
122
						</td>
123
						<td>
124
<?php
125
		$members_arr = explode(" ", $ifgroupentry['members']);
126
		$iflist = get_configured_interface_with_descr(false, true);
127
		$memberses_arr = array();
128
		foreach ($members_arr as $memb) {
129
			$memberses_arr[] = $iflist[$memb] ? $iflist[$memb] : $memb;
130
		}
131

    
132
		unset($iflist);
133
		$memberses = implode(", ", $memberses_arr);
134
		echo $memberses;
135
		if (count($members_arr) >= 10) {
136
			echo '&hellip;';
137
		}
138
?>
139
						</td>
140
						<td>
141
							<?=htmlspecialchars($ifgroupentry['descr']);?>
142
						</td>
143
						<td>
144
							<a class="fa fa-pencil"	title="<?=gettext('Edit group')?>"	href="interfaces_groups_edit.php?id=<?=$i; ?>"></a>
145
							<a class="fa fa-trash"	title="<?=gettext('Delete group')?>"	href="interfaces_groups.php?act=del&amp;id=<?=$i; ?>"></a>
146
						</td>
147
					</tr>
148
<?php endforeach; ?>
149
				</tbody>
150
			</table>
151
		</div>
152
	</div>
153
</div>
154

    
155
<nav class="action-buttons">
156
	<a class="btn btn-success btn-sm" href="interfaces_groups_edit.php" role="button">
157
		<i class="fa fa-plus icon-embed-btn"></i>
158
		<?=gettext("Add");?>
159
	</a>
160
</nav>
161

    
162
<div class="infoblock">
163
	<?php print_info_box(gettext('Interface Groups allow setting up rules for multiple interfaces without duplicating the rules.<br />' .
164
					   'If members are removed from an interface group, the group rules are no longer applicable to that interface.'), 'info', false); ?>
165

    
166
</div>
167
<?php
168

    
169
include("foot.inc");
(76-76/225)