Project

General

Profile

Download (6.35 KB) Statistics
| Branch: | Tag: | Revision:
1 0ec2fdf0 Ermal Lu?i
<?php
2
/*
3 6317d31d Phil Davis
	interfaces_groups.php
4
5
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
6 1d7ba683 ayvis
	Copyright (C) 2009 Ermal Luçi
7 0ec2fdf0 Ermal Lu?i
	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 7ac5a4cb Scott Ullrich
/*
32
	pfSense_BUILDER_BINARIES:	/sbin/ifconfig
33
	pfSense_MODULE:	interfaces
34
*/
35 0ec2fdf0 Ermal Lu?i
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 654998ee Carlos Eduardo Ramos
require_once("functions.inc");
45 0ec2fdf0 Ermal Lu?i
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 073cd52e Ermal
		$members = explode(" ", $a_ifgroups[$_GET['id']]['members']);
54 42753d25 Ermal Lu?i
		foreach ($members as $ifs) {
55
			$realif = get_real_interface($ifs);
56
			if ($realif)
57 073cd52e Ermal
				mwexec("/sbin/ifconfig  {$realif} -group " . $a_ifgroups[$_GET['id']]['ifname']);
58 42753d25 Ermal Lu?i
		}
59 0ec2fdf0 Ermal Lu?i
		unset($a_ifgroups[$_GET['id']]);
60
		write_config();
61
		header("Location: interfaces_groups.php");
62
		exit;
63
	}
64
}
65
66 bd33744d Rafael Lucas
$pgtitle = array(gettext("Interfaces"),gettext("Groups"));
67 b32dd0a6 jim-p
$shortcut_section = "interfaces";
68 0ec2fdf0 Ermal Lu?i
include("head.inc");
69
70
?>
71
72
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
73
<?php include("fbegin.inc"); ?>
74
75 0f83dd7b Colin Fleming
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="interfaces groups">
76 0ec2fdf0 Ermal Lu?i
  <tr><td>
77
<?php
78 d02951e9 gnhb
	$tab_array = array();
79 bd33744d Rafael Lucas
	$tab_array[0] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
80
	$tab_array[1] = array(gettext("Interface Groups"), true, "interfaces_groups.php");
81
	$tab_array[2] = array(gettext("Wireless"), false, "interfaces_wireless.php");
82
	$tab_array[3] = array(gettext("VLANs"), false, "interfaces_vlan.php");
83
	$tab_array[4] = array(gettext("QinQs"), false, "interfaces_qinq.php");
84
	$tab_array[5] = array(gettext("PPPs"), false, "interfaces_ppps.php");
85
	$tab_array[6] = array(gettext("GRE"), false, "interfaces_gre.php");
86
	$tab_array[7] = array(gettext("GIF"), false, "interfaces_gif.php");
87
	$tab_array[8] = array(gettext("Bridges"), false, "interfaces_bridge.php");
88
	$tab_array[9] = array(gettext("LAGG"), false, "interfaces_lagg.php");
89 d02951e9 gnhb
	display_top_tabs($tab_array);
90 0ec2fdf0 Ermal Lu?i
?>
91
  </td></tr>
92
<tr>
93
    <td>
94
        <div id="mainarea">
95 0f83dd7b Colin Fleming
        <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
96 0ec2fdf0 Ermal Lu?i
97
<tr>
98 bd33744d Rafael Lucas
  <td width="15%" class="listhdrr"><?=gettext("Name");?></td>
99
  <td width="35%" class="listhdrr"><?=gettext("Members");?></td>
100
  <td width="25%" class="listhdr"><?=gettext("Description");?></td>
101 0ec2fdf0 Ermal Lu?i
  <td width="5%" class="list"></td>
102
</tr>
103
	  <?php if (count ($a_ifgroups)):
104
		$i = 0; foreach ($a_ifgroups as $ifgroupentry): ?>
105
<tr>
106
  <td class="listlr" ondblclick="document.location='interfaces_groups_edit.php?id=<?=$i;?>';">
107 22e6d572 Ermal Lu?i
	<a href="/firewall_rules.php?if=<?=htmlspecialchars($ifgroupentry['ifname']);?>"><?=htmlspecialchars($ifgroupentry['ifname']);?></a>
108 0ec2fdf0 Ermal Lu?i
  </td>
109
  <td class="listr" ondblclick="document.location='interfaces_groups_edit.php?id=<?=$i;?>';">
110
      <?php
111 42753d25 Ermal Lu?i
	$members_arr = explode(" ", $ifgroupentry['members']);
112 6e73977b Renato Botelho
	$iflist = get_configured_interface_with_descr(false, true);
113 22e6d572 Ermal Lu?i
	$memberses_arr = array();
114 0ec2fdf0 Ermal Lu?i
	foreach ($members_arr as $memb)
115
		$memberses_arr[] = $iflist[$memb] ? $iflist[$memb] : $memb;
116 36b9bb28 Renato Botelho
	unset($iflist);
117 0ec2fdf0 Ermal Lu?i
	$memberses = implode(", ", $memberses_arr);
118
	echo $memberses;
119
	if(count($members_arr) < 10) {
120
		echo " ";
121
	} else {
122
		echo "...";
123
	}
124
    ?>
125
  </td>
126
  <td class="listbg" ondblclick="document.location='interfaces_groups_edit.php?id=<?=$i;?>';">
127
    <?=htmlspecialchars($ifgroupentry['descr']);?>&nbsp;
128
  </td>
129 0f83dd7b Colin Fleming
  <td valign="middle" class="list nowrap">
130
    <table border="0" cellspacing="0" cellpadding="1" summary="icons">
131 0ec2fdf0 Ermal Lu?i
      <tr>
132 0f83dd7b Colin Fleming
        <td valign="middle"><a href="interfaces_groups_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" title="<?=gettext("edit group");?>" alt="edit" /></a></td>
133
        <td><a href="interfaces_groups.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this group? All elements that still use it will become invalid (e.g. filter rules)!");?>')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("delete ifgroupentry");?>" alt="delete" /></a></td>
134 0ec2fdf0 Ermal Lu?i
      </tr>
135
    </table>
136
  </td>
137
</tr>
138
	  <?php $i++; endforeach; endif;?>
139
<tr>
140
  <td class="list" colspan="3"></td>
141
  <td class="list">
142 0f83dd7b Colin Fleming
    <table border="0" cellspacing="0" cellpadding="1" summary="add">
143 0ec2fdf0 Ermal Lu?i
      <tr>
144
	<td valign="middle" width="17">&nbsp;</td>
145 0f83dd7b Colin Fleming
        <td valign="middle"><a href="interfaces_groups_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add a new group");?>" alt="add" /></a></td>
146 0ec2fdf0 Ermal Lu?i
      </tr>
147
    </table>
148
  </td>
149
</tr>
150
<tr>
151
  <td class="tabcont" colspan="3">
152 1d7ba683 ayvis
	<p><span class="vexpl"><span class="red"><strong><?=gettext("Note:");?><br /></strong></span><?=gettext("Interface Groups allow you to create rules that apply to multiple interfaces without duplicating the rules. If you remove members from an interface group, the group rules no longer apply to that interface.");?></span></p>
153 0ec2fdf0 Ermal Lu?i
	</td>
154
</tr>
155
	</table>
156
	</div>
157
 </td>
158
</tr>
159
</table>
160
<?php include("fend.inc"); ?>
161
</body>
162
</html>