Project

General

Profile

Download (4.32 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-2019 Rubicon Communications, LLC (Netgate)
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
init_config_arr(array('ifgroups', 'ifgroupentry'));
33
$a_ifgroups = &$config['ifgroups']['ifgroupentry'];
34

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

    
51
$pgtitle = array(gettext("Interfaces"), gettext("Interface Groups"));
52
$shortcut_section = "interfaces";
53

    
54
include("head.inc");
55

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

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

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

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

    
131
</div>
132
<?php
133

    
134
include("foot.inc");
(80-80/235)