Project

General

Profile

Download (4.72 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
	interfaces_groups.php
4

    
5
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
6
	Copyright (C) 2009 Ermal Luçi
7
	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
/*
32
	pfSense_BUILDER_BINARIES:	/sbin/ifconfig
33
	pfSense_MODULE: interfaces
34
*/
35

    
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
require_once("functions.inc");
45

    
46
if (!is_array($config['ifgroups']['ifgroupentry'])) {
47
	$config['ifgroups']['ifgroupentry'] = array();
48
}
49

    
50
$a_ifgroups = &$config['ifgroups']['ifgroupentry'];
51

    
52
if ($_GET['act'] == "del") {
53
	if ($a_ifgroups[$_GET['id']]) {
54
		$members = explode(" ", $a_ifgroups[$_GET['id']]['members']);
55
		foreach ($members as $ifs) {
56
			$realif = get_real_interface($ifs);
57
			if ($realif) {
58
				mwexec("/sbin/ifconfig {$realif} -group " . $a_ifgroups[$_GET['id']]['ifname']);
59
			}
60
		}
61
		unset($a_ifgroups[$_GET['id']]);
62
		write_config();
63
		header("Location: interfaces_groups.php");
64
		exit;
65
	}
66
}
67

    
68
$pgtitle = array(gettext("Interfaces"), gettext("Groups"));
69
$shortcut_section = "interfaces";
70

    
71
include("head.inc");
72

    
73
$tab_array = array();
74
$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
display_top_tabs($tab_array);
85

    
86
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
?>
89
<div class="table-responsive">
90
	<table class="table table-striped table-hover table-condensed">
91
		<thead>
92
			<tr>
93
				<th><?=gettext('Name');?></th>
94
				<th><?=gettext('Members');?></th>
95
				<th><?=gettext('Description');?></th>
96
				<th></th>
97
			</tr>
98
		</thead>
99
		<tbody>
100
<?php foreach ($a_ifgroups as $i => $ifgroupentry): ?>
101
			<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
		if(count($members_arr) >= 10) {
117
			echo '&hellip;';
118
		}
119
?>
120
				</td>
121
				<td>
122
					<?=htmlspecialchars($ifgroupentry['descr']);?>
123
				</td>
124
				<td>
125
					<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
				</td>
132
			</tr>
133
<?php endforeach; ?>
134
		</tbody>
135
	</table>
136
</div>
137

    
138
<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
<?php
145

    
146
include("fend.inc");
(90-90/237)