Project

General

Profile

Download (6.28 KB) Statistics
| Branch: | Tag: | Revision:
1 0ec2fdf0 Ermal Lu?i
<?php
2
/*
3 1d7ba683 ayvis
	Copyright (C) 2009 Ermal Luçi
4 0ec2fdf0 Ermal Lu?i
	Copyright (C) 2004 Scott Ullrich
5
	All rights reserved.
6
7
	Redistribution and use in source and binary forms, with or without
8
	modification, are permitted provided that the following conditions are met:
9
10
	1. Redistributions of source code must retain the above copyright notice,
11
	   this list of conditions and the following disclaimer.
12
13
	2. Redistributions in binary form must reproduce the above copyright
14
	   notice, this list of conditions and the following disclaimer in the
15
	   documentation and/or other materials provided with the distribution.
16
17
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
19
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
20
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
21
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
	POSSIBILITY OF SUCH DAMAGE.
27
*/
28 7ac5a4cb Scott Ullrich
/*
29
	pfSense_BUILDER_BINARIES:	/sbin/ifconfig
30
	pfSense_MODULE:	interfaces
31
*/
32 0ec2fdf0 Ermal Lu?i
33
##|+PRIV
34
##|*IDENT=page-interfaces-groups
35
##|*NAME=Interfaces: Groups page
36
##|*DESCR=Create interface groups
37
##|*MATCH=interfaces_groups.php*
38
##|-PRIV
39
40
require("guiconfig.inc");
41 654998ee Carlos Eduardo Ramos
require_once("functions.inc");
42 0ec2fdf0 Ermal Lu?i
43
if (!is_array($config['ifgroups']['ifgroupentry']))
44
	$config['ifgroups']['ifgroupentry'] = array();
45
46
$a_ifgroups = &$config['ifgroups']['ifgroupentry'];
47
48
if ($_GET['act'] == "del") {
49
	if ($a_ifgroups[$_GET['id']]) {
50 073cd52e Ermal
		$members = explode(" ", $a_ifgroups[$_GET['id']]['members']);
51 42753d25 Ermal Lu?i
		foreach ($members as $ifs) {
52
			$realif = get_real_interface($ifs);
53
			if ($realif)
54 073cd52e Ermal
				mwexec("/sbin/ifconfig  {$realif} -group " . $a_ifgroups[$_GET['id']]['ifname']);
55 42753d25 Ermal Lu?i
		}
56 0ec2fdf0 Ermal Lu?i
		unset($a_ifgroups[$_GET['id']]);
57
		write_config();
58
		header("Location: interfaces_groups.php");
59
		exit;
60
	}
61
}
62
63 bd33744d Rafael Lucas
$pgtitle = array(gettext("Interfaces"),gettext("Groups"));
64 b32dd0a6 jim-p
$shortcut_section = "interfaces";
65 0ec2fdf0 Ermal Lu?i
include("head.inc");
66
67
?>
68
69
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
70
<?php include("fbegin.inc"); ?>
71
72 0f83dd7b Colin Fleming
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="interfaces groups">
73 0ec2fdf0 Ermal Lu?i
  <tr><td>
74
<?php
75 d02951e9 gnhb
	$tab_array = array();
76 bd33744d Rafael Lucas
	$tab_array[0] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
77
	$tab_array[1] = array(gettext("Interface Groups"), true, "interfaces_groups.php");
78
	$tab_array[2] = array(gettext("Wireless"), false, "interfaces_wireless.php");
79
	$tab_array[3] = array(gettext("VLANs"), false, "interfaces_vlan.php");
80
	$tab_array[4] = array(gettext("QinQs"), false, "interfaces_qinq.php");
81
	$tab_array[5] = array(gettext("PPPs"), false, "interfaces_ppps.php");
82
	$tab_array[6] = array(gettext("GRE"), false, "interfaces_gre.php");
83
	$tab_array[7] = array(gettext("GIF"), false, "interfaces_gif.php");
84
	$tab_array[8] = array(gettext("Bridges"), false, "interfaces_bridge.php");
85
	$tab_array[9] = array(gettext("LAGG"), false, "interfaces_lagg.php");
86 d02951e9 gnhb
	display_top_tabs($tab_array);
87 0ec2fdf0 Ermal Lu?i
?>
88
  </td></tr>
89
<tr>
90
    <td>
91
        <div id="mainarea">
92 0f83dd7b Colin Fleming
        <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
93 0ec2fdf0 Ermal Lu?i
94
<tr>
95 bd33744d Rafael Lucas
  <td width="15%" class="listhdrr"><?=gettext("Name");?></td>
96
  <td width="35%" class="listhdrr"><?=gettext("Members");?></td>
97
  <td width="25%" class="listhdr"><?=gettext("Description");?></td>
98 0ec2fdf0 Ermal Lu?i
  <td width="5%" class="list"></td>
99
</tr>
100
	  <?php if (count ($a_ifgroups)):
101
		$i = 0; foreach ($a_ifgroups as $ifgroupentry): ?>
102
<tr>
103
  <td class="listlr" ondblclick="document.location='interfaces_groups_edit.php?id=<?=$i;?>';">
104 22e6d572 Ermal Lu?i
	<a href="/firewall_rules.php?if=<?=htmlspecialchars($ifgroupentry['ifname']);?>"><?=htmlspecialchars($ifgroupentry['ifname']);?></a>
105 0ec2fdf0 Ermal Lu?i
  </td>
106
  <td class="listr" ondblclick="document.location='interfaces_groups_edit.php?id=<?=$i;?>';">
107
      <?php
108 42753d25 Ermal Lu?i
	$members_arr = explode(" ", $ifgroupentry['members']);
109 6e73977b Renato Botelho
	$iflist = get_configured_interface_with_descr(false, true);
110 22e6d572 Ermal Lu?i
	$memberses_arr = array();
111 0ec2fdf0 Ermal Lu?i
	foreach ($members_arr as $memb)
112
		$memberses_arr[] = $iflist[$memb] ? $iflist[$memb] : $memb;
113 36b9bb28 Renato Botelho
	unset($iflist);
114 0ec2fdf0 Ermal Lu?i
	$memberses = implode(", ", $memberses_arr);
115
	echo $memberses;
116
	if(count($members_arr) < 10) {
117
		echo " ";
118
	} else {
119
		echo "...";
120
	}
121
    ?>
122
  </td>
123
  <td class="listbg" ondblclick="document.location='interfaces_groups_edit.php?id=<?=$i;?>';">
124
    <?=htmlspecialchars($ifgroupentry['descr']);?>&nbsp;
125
  </td>
126 0f83dd7b Colin Fleming
  <td valign="middle" class="list nowrap">
127
    <table border="0" cellspacing="0" cellpadding="1" summary="icons">
128 0ec2fdf0 Ermal Lu?i
      <tr>
129 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>
130
        <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>
131 0ec2fdf0 Ermal Lu?i
      </tr>
132
    </table>
133
  </td>
134
</tr>
135
	  <?php $i++; endforeach; endif;?>
136
<tr>
137
  <td class="list" colspan="3"></td>
138
  <td class="list">
139 0f83dd7b Colin Fleming
    <table border="0" cellspacing="0" cellpadding="1" summary="add">
140 0ec2fdf0 Ermal Lu?i
      <tr>
141
	<td valign="middle" width="17">&nbsp;</td>
142 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>
143 0ec2fdf0 Ermal Lu?i
      </tr>
144
    </table>
145
  </td>
146
</tr>
147
<tr>
148
  <td class="tabcont" colspan="3">
149 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>
150 0ec2fdf0 Ermal Lu?i
	</td>
151
</tr>
152
	</table>
153
	</div>
154
 </td>
155
</tr>
156
</table>
157
<?php include("fend.inc"); ?>
158
</body>
159
</html>