Project

General

Profile

Download (4.71 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
$a_ifgroups = &$config['ifgroups']['ifgroupentry'];
50

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

    
66
$pgtitle = array(gettext("Interfaces"),gettext("Groups"));
67
$shortcut_section = "interfaces";
68

    
69
include("head.inc");
70

    
71
$tab_array = array();
72
$tab_array[] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
73
$tab_array[] = array(gettext("Interface Groups"), true, "interfaces_groups.php");
74
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
75
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
76
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
77
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
78
$tab_array[] = array(gettext("GRE"), false, "interfaces_gre.php");
79
$tab_array[] = array(gettext("GIF"), false, "interfaces_gif.php");
80
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
81
$tab_array[] = array(gettext("LAGG"), false, "interfaces_lagg.php");
82
display_top_tabs($tab_array);
83

    
84
print_info_box(gettext('Interface Groups allow you to setup rules for multiple interfaces without duplicating the rules.<br />' .
85
					   'If you remove members from an interface group, the group rules are no longer applicable to that interface.'));
86
?>
87
<div class="table-responsive">
88
	<table class="table table-striped table-hover table-condensed">
89
		<thead>
90
			<tr>
91
				<th><?=gettext('Name');?></th>
92
				<th><?=gettext('Members');?></th>
93
				<th><?=gettext('Description');?></th>
94
				<th></th>
95
			</tr>
96
		</thead>
97
		<tbody>
98
<?php foreach ($a_ifgroups as $i => $ifgroupentry): ?>
99
			<tr>
100
				<td>
101
					<?=htmlspecialchars($ifgroupentry['ifname']); ?>
102
				</td>
103
				<td>
104
<?php
105
		$members_arr = explode(" ", $ifgroupentry['members']);
106
		$iflist = get_configured_interface_with_descr(false, true);
107
		$memberses_arr = array();
108
		foreach ($members_arr as $memb)
109
			$memberses_arr[] = $iflist[$memb] ? $iflist[$memb] : $memb;
110

    
111
		unset($iflist);
112
		$memberses = implode(", ", $memberses_arr);
113
		echo $memberses;
114
		if(count($members_arr) >= 10) {
115
			echo '&hellip;';
116
		}
117
?>
118
				</td>
119
				<td>
120
					<?=htmlspecialchars($ifgroupentry['descr']);?>
121
				</td>
122
				<td>
123
					<a class="btn btn-default btn-sm" role="button" href="interfaces_groups_edit.php?id=<?=$i; ?>">
124
						<?=gettext('Edit'); ?>
125
					</a>
126
					<a class="btn btn-danger btn-sm" role="button" href="interfaces_groups.php?act=del&amp;id=<?=$i; ?>">
127
						<?=gettext("Delete"); ?>
128
					</a>
129
				</td>
130
			</tr>
131
<?php endforeach; ?>
132
		</tbody>
133
	</table>
134
</div>
135

    
136
<nav class="action-buttons">
137
	<a class="btn btn-success btn-sm" href="interfaces_groups_edit.php" role="button">
138
		<?=gettext("Add Group");?>
139
	</a>
140
</nav>
141

    
142
<?php
143

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