Project

General

Profile

Download (4.34 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
 * 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
 *
13
 * http://www.apache.org/licenses/LICENSE-2.0
14
 *
15
 * 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
 */
21

    
22
##|+PRIV
23
##|*IDENT=page-interfaces-groups
24
##|*NAME=Interfaces: Groups
25
##|*DESCR=Create interface groups
26
##|*MATCH=interfaces_groups.php*
27
##|-PRIV
28

    
29
require_once("guiconfig.inc");
30
require_once("functions.inc");
31

    
32
if (!is_array($config['ifgroups']['ifgroupentry'])) {
33
	$config['ifgroups']['ifgroupentry'] = array();
34
}
35

    
36
$a_ifgroups = &$config['ifgroups']['ifgroupentry'];
37

    
38
if ($_GET['act'] == "del") {
39
	if ($a_ifgroups[$_GET['id']]) {
40
		$members = explode(" ", $a_ifgroups[$_GET['id']]['members']);
41
		foreach ($members as $ifs) {
42
			$realif = get_real_interface($ifs);
43
			if ($realif) {
44
				mwexec("/sbin/ifconfig {$realif} -group " . $a_ifgroups[$_GET['id']]['ifname']);
45
			}
46
		}
47
		unset($a_ifgroups[$_GET['id']]);
48
		write_config();
49
		header("Location: interfaces_groups.php");
50
		exit;
51
	}
52
}
53

    
54
$pgtitle = array(gettext("Interfaces"), gettext("Interface Groups"));
55
$shortcut_section = "interfaces";
56

    
57
include("head.inc");
58

    
59
$tab_array = array();
60
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
61
$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
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
67
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
68
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
69
$tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php");
70
display_top_tabs($tab_array);
71
?>
72
<div class="panel panel-default">
73
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('Interface Groups')?></h2></div>
74
	<div class="panel-body">
75
		<div class="table-responsive">
76
			<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
77
				<thead>
78
					<tr>
79
						<th><?=gettext('Name');?></th>
80
						<th><?=gettext('Members');?></th>
81
						<th><?=gettext('Description');?></th>
82
						<th><?=gettext('Actions');?></th>
83
					</tr>
84
				</thead>
85
				<tbody>
86
<?php foreach ($a_ifgroups as $i => $ifgroupentry): ?>
87
					<tr>
88
						<td>
89
							<?=htmlspecialchars($ifgroupentry['ifname']); ?>
90
						</td>
91
						<td>
92
<?php
93
		$members_arr = explode(" ", $ifgroupentry['members']);
94
		$iflist = get_configured_interface_with_descr(false, true);
95
		$memberses_arr = array();
96
		foreach ($members_arr as $memb) {
97
			$memberses_arr[] = $iflist[$memb] ? $iflist[$memb] : $memb;
98
		}
99

    
100
		unset($iflist);
101
		$memberses = implode(", ", $memberses_arr);
102
		echo $memberses;
103
		if (count($members_arr) >= 10) {
104
			echo '&hellip;';
105
		}
106
?>
107
						</td>
108
						<td>
109
							<?=htmlspecialchars($ifgroupentry['descr']);?>
110
						</td>
111
						<td>
112
							<a class="fa fa-pencil"	title="<?=gettext('Edit group')?>"	href="interfaces_groups_edit.php?id=<?=$i; ?>"></a>
113
							<a class="fa fa-trash"	title="<?=gettext('Delete group')?>"	href="interfaces_groups.php?act=del&amp;id=<?=$i; ?>"></a>
114
						</td>
115
					</tr>
116
<?php endforeach; ?>
117
				</tbody>
118
			</table>
119
		</div>
120
	</div>
121
</div>
122

    
123
<nav class="action-buttons">
124
	<a class="btn btn-success btn-sm" href="interfaces_groups_edit.php" role="button">
125
		<i class="fa fa-plus icon-embed-btn"></i>
126
		<?=gettext("Add");?>
127
	</a>
128
</nav>
129

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

    
134
</div>
135
<?php
136

    
137
include("foot.inc");
(76-76/227)